Processing data from loop

조회 수: 5 (최근 30일)
Eliska Paulikova
Eliska Paulikova 2022년 11월 8일
편집: Voss 2022년 11월 8일
Hello I have a problem, I have a video which I cut into many frames I apply on them segmentation and I get x and y values from them. So now I have triple loop cycle, and every single round it gives me x and y for one frame --> but I would like to make table or something where I can store data, for every single frame.
Now If I do it I get so many tables or I get one with data only from the last frame --> but I would like to have one table and in it has values from every frames.
How can I do that. Is there any function?
Thank you so much.

답변 (1개)

Voss
Voss 2022년 11월 8일
편집: Voss 2022년 11월 8일
% empty table with two variables, X and Y:
t = table([],[],'VariableNames',{'X' 'Y'})
t = 0×2 empty table
Nframes = 3;
% for each frame ...
for ii = 1:Nframes
% ... append a row to the table, containing the X and Y for this frame
% (using random numbers here):
t(end+1,:) = {rand() rand()}
end
t = 1×2 table
X Y ________ _______ 0.015738 0.69204
t = 2×2 table
X Y ________ _______ 0.015738 0.69204 0.82888 0.60574
t = 3×2 table
X Y ________ _______ 0.015738 0.69204 0.82888 0.60574 0.75563 0.57025

카테고리

Help CenterFile Exchange에서 Images에 대해 자세히 알아보기

제품


릴리스

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by