Borrar filtros
Borrar filtros

creating a matrix with different vector length using a loop

5 visualizaciones (últimos 30 días)
Paola
Paola el 11 de Ag. de 2021
Comentada: Paola el 17 de Ag. de 2021
Hi,
I would like to create a matrix with different vectors that have different lengths (I take this vectror from a filelist), and I would like to do it using a loop. I alredy wrote this part of the code but it doesn' work. can someone help me with this? thanks
lfl=length(filelist)
for ii=1:lfl
ii
load([filelist(ii).name],'dist_pre','A_fin_mean')
distpret(ii)=dist_pre
A_fin_mean(ii)=A_fin_mean
end

Respuesta aceptada

Walter Roberson
Walter Roberson el 11 de Ag. de 2021
lfl=length(filelist);
distpret = cell(lfl, 1);
A_fin_mean = cell(ifl, 1);
for ii=1:lfl
data = load(filelist(ii).name,'dist_pre','A_fin_mean')
distpret{ii} = data.dist_pre;
A_fin_mean{ii} = data.A_fin_mean;
end

Más respuestas (0)

Categorías

Más información sobre Loops and Conditional Statements en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by