I want to make a table with single array
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Hi everyone,
I have a code when I take height (Hs) and period (Tm) by direction with the index above. Now, I want to save in a table the height and period of the same direction but when I try to do a table I obtain this error.
North_sec = table(Hs_N,Tm_N)
Variable index exceeds table dimensions.
I'm attacching the code below:
fileName = 'D:\Valerio\data\test.mat';
%fileName = 'D:\Valerio\data\IPCC_data_models\ACCESS1_0.mat';
loadfile = load(fileName);
table = loadfile.table_def;
%time_table = table2timetable(loadfile.table_def);
date_array = table.YYMMDD;
hour_array = table.HH;
Hs = table.Hs_tot;
Tm = table.Tm_tot;
Dm = table.Dm_tot;
date_num = datenum(date_array);
North = find((Dm >= 337.5 & Dm <= 360.0) | (Dm >= 0.0 & Dm <= 22.5));
North_East = find(Dm >=22.5 & Dm <= 67.5);
East = find(Dm >=67.5 & Dm <= 112.5);
South_East = find(Dm >=112.5 & Dm <= 157.5);
South = find(Dm >=157.5 & Dm <= 202.5);
South_West = find(Dm >=202.5 & Dm <= 247.5);
West = find(Dm >=247.5 & Dm <= 292.5);
North_West = find(Dm >=292.5 & Dm <= 337.5);
Hs_N = Hs(North);
Hs_NE = Hs(North_East);
Hs_E = Hs(East);
Hs_SE = Hs(South_East);
Hs_S = Hs(South);
Hs_SW = Hs(South_West);
Hs_W = Hs(West);
Hs_NW = Hs(North_West);
Tm_N = Tm(North);
Tm_NE = Tm(North_East);
Tm_E = Tm(East);
Tm_SE = Tm(South_East);
Tm_S = Tm(South);
Tm_SW = Tm(South_West);
Tm_W = Tm(West);
Tm_NW = Tm(North_West);
North_sec = table(Hs_N,Tm_N);
North_East = table(Hs_NE,Tm_NE);
East = table(Hs_E,Tm_E);
South_East = table(Hs_SE,Tm_SE);
South = table(Hs_S,Tm_S);
South_West = table(Hs_SW,Tm_SW);
West = table(Hs_W,Tm_W);
North_West = table(Hs_NW,Tm_NW);
1 Kommentar
Antworten (1)
Steven Lord
am 4 Mär. 2020
table = loadfile.table_def;
While a variable named table exists you cannot call the table function. I recommend clearing the variable and modifying your code to avoid creating a variable with that name.
0 Kommentare
Siehe auch
Kategorien
Mehr zu Tables finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!