How. do I combine variables into one Matrix?

1 Ansicht (letzte 30 Tage)
Shayma Al Ali
Shayma Al Ali am 8 Dez. 2020
Beantwortet: Walter Roberson am 8 Dez. 2020
I have about 25 stations with the same variable. I want to extract the variable from each file and combine them into one matrix, so that each column in the matrix is one station. The code below is what ive attempted but failed:
direc=dir('*.mat');
station=[];
for i=length(direc)
load(direc(i).name);
station=[station;zonal1.station];
end

Antworten (1)

Walter Roberson
Walter Roberson am 8 Dez. 2020
station(:, i) = zonal1.station(:);
This will fail if the data is not all the same size.

Kategorien

Mehr zu MATLAB 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!

Translated by