Save data from cycle into one table

조회 수: 4 (최근 30일)
Eliska Paulikova
Eliska Paulikova 2022년 11월 12일
편집: Eliska Paulikova 2022년 11월 14일
Hello, I have a code where the aotput is x and y, but I would like to store this data into one table or varieble. Problem is, that it gives me data only in one cyklus and it gives me it 15 times the same data, and than for h=2 it gives me 14 times the same value .. and so on
I would like to get one x and y from every loop and save it in one table or whatever, so after the code is ended, I would like to have everything in one place, if you understand. Now it gives me separately for every loop.
Thank you so much

채택된 답변

Image Analyst
Image Analyst 2022년 11월 12일
x and y are the locations of all the white pixels in the image. There will likely be tens of thousands of values in each vector. Did you want the x and y of the blob centroid(s) instead?
What if you just stored the x and y in a cell array
ca{h, 1} = x;
ca{h, 2} = y;
Not sure why you have a loop within a loop but maybe you want i instead of h in the lines of code above.
Can we run your code with the demo that ships with MATLAB, rhinos.avi, or do we need your specific video to be attached?
  댓글 수: 8
Image Analyst
Image Analyst 2022년 11월 13일
You can ask regionprops for a table. Then you can append the table for this frame to the growing master table.
thisTable = regionprops('table', BW);
if frameNumber == 1
masterTable = thisTable;
else
masterTable = [masterTable; thisTable];
end
Eliska Paulikova
Eliska Paulikova 2022년 11월 14일
편집: Eliska Paulikova 2022년 11월 14일
Thank you so much, I appreciate it a lot
It helped

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

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

제품


릴리스

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by