command squeeze in bucle
조회 수: 21 (최근 30일)
이전 댓글 표시
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
댓글 수: 0
답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Performance and Memory에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!