command squeeze in bucle

2 Ansichten (letzte 30 Tage)
Hernaldo Leyton
Hernaldo Leyton am 11 Okt. 2017
I have a question, what happens is that I have 15 arrays or cell arrays, corresponding to 15 days, that is 1 array or array per day. I need to remove a dimension and I'm applying squeeze, but I can not find a way to loop to not write 15 lines of code. So far I have the following:
Estaciones.DMC.LoPrado.Mod.Var3D.P.AllNivel.Dia1=squeeze(Mod.Var3D.P.AllNivel.Dia1(i1,j1,:)); Estaciones.DMC.LoPrado.Mod.Var3D.P.AllNivel.Dia2=squeeze(Mod.Var3D.P.AllNivel.Dia2(i1,j1,:)); Estaciones.DMC.LoPrado.Mod.Var3D.P.AllNivel.Dia3=squeeze(Mod.Var3D.P.AllNivel.Dia3(i1,j1,:)); Estaciones.DMC.LoPrado.Mod.Var3D.P.AllNivel.Dia4=squeeze(Mod.Var3D.P.AllNivel.Dia4(i1,j1,:)); Estaciones.DMC.LoPrado.Mod.Var3D.P.AllNivel.Dia5=squeeze(Mod.Var3D.P.AllNivel.Dia5(i1,j1,:)); Estaciones.DMC.LoPrado.Mod.Var3D.P.AllNivel.Dia6=squeeze(Mod.Var3D.P.AllNivel.Dia6(i1,j1,:)); Estaciones.DMC.LoPrado.Mod.Var3D.P.AllNivel.Dia7=squeeze(Mod.Var3D.P.AllNivel.Dia7(i1,j1,:)); Estaciones.DMC.LoPrado.Mod.Var3D.P.AllNivel.Dia8=squeeze(Mod.Var3D.P.AllNivel.Dia8(i1,j1,:)); Estaciones.DMC.LoPrado.Mod.Var3D.P.AllNivel.Dia9=squeeze(Mod.Var3D.P.AllNivel.Dia9(i1,j1,:)); Estaciones.DMC.LoPrado.Mod.Var3D.P.AllNivel.Dia10=squeeze(Mod.Var3D.P.AllNivel.Dia10(i1,j1,:)); Estaciones.DMC.LoPrado.Mod.Var3D.P.AllNivel.Dia11=squeeze(Mod.Var3D.P.AllNivel.Dia11(i1,j1,:)); Estaciones.DMC.LoPrado.Mod.Var3D.P.AllNivel.Dia12=squeeze(Mod.Var3D.P.AllNivel.Dia12(i1,j1,:)); Estaciones.DMC.LoPrado.Mod.Var3D.P.AllNivel.Dia13=squeeze(Mod.Var3D.P.AllNivel.Dia13(i1,j1,:)); Estaciones.DMC.LoPrado.Mod.Var3D.P.AllNivel.Dia14=squeeze(Mod.Var3D.P.AllNivel.Dia14(i1,j1,:)); Estaciones.DMC.LoPrado.Mod.Var3D.P.AllNivel.Dia15=squeeze(Mod.Var3D.P.AllNivel.Dia15(i1,j1,:));
I was trying with
for k=1:16; eval(sprintf('Estaciones.DMC.LoPrado.Mod.Var3D.P.AllNivel.Dia%d = squeeze(Mod.Var3D.P.AllNivel.Dia%d(i1,j1,:))', k)); end
but I throw mistake
Is there any way to loop?
Regards
First of all, Thanks

Antworten (0)

Kategorien

Mehr zu Performance and Memory 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