why my loop keeps only the last run?
조회 수: 2(최근 30일)
표시 이전 댓글
Ivan Mich 2023년 1월 30일
답변: Image Analyst 2023년 1월 30일
I am creating a zeros cell with dimensions 2x4 in order to work in a loop. the problem is that my script do not keep all the runs of the loop, but only the last one. As a result I have a cell array 1x4 and not 2x4 as I wanted.
I have tried:
C=[A(z) B(z) D(z) E(z)]
%A,B,D,E are variables
Could you please help me?
Image Analyst 2023년 1월 30일
You're not indexing C so you're just overwriting it every time. Fix:
C(z, :) =[A(z) B(z) D(z) E(z)];
Find more on Structures in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!