how to save/write images using for loop in one .mat file
이전 댓글 표시
I want to save file path and roi of 10 images coming from a loop in one .mat file
댓글 수: 4
Rik
2020년 6월 2일
The most efficient way is probably to store your output data is a variable and store it after the loop, instead of appending the data inside the loop.
richa golash
2020년 6월 2일
Ameer Hamza
2020년 6월 2일
Can you show the code?
KALYAN ACHARJYA
2020년 6월 2일
Save the images in cell array (multiple_rows,one cloumn), later cell2mat and save?
답변 (1개)
Rik
2020년 6월 2일
As Ameer suggests: you should share the code, so we can suggest how you can implement indexing.
The point is that your code currently looks like the top block, and should look like the bottom block.
for n=1:10
out=n+rand;%will overwrite
end
out=zeros(1,10);
for n=1:10
out(n)=n+rand;
end
댓글 수: 6
richa golash
2020년 6월 2일
Rik
2020년 6월 2일
Do all the mat files have different variable names? Or do you want to create a struct array? What data shape do you want to end up with?
richa golash
2020년 6월 2일
Rik
2020년 6월 2일
Can you write the code with numbered variables so I can suggest the exact code you could use?
%e.g. this:
k=1;F=sprintf('Img21/X_%d.mat',k);
C_1_1=T.A;C_1_2=T.B;
k=2;F=sprintf('Img21/X_%d.mat',k);
C_2_1=T.A;C_2_2=T.B;
M={C_1_1,C_1_2;C_2_1,C_2_2};
(you shouldn't be using code like this, but it helps to show what the output should be)
richa golash
2020년 6월 2일
richa golash
2020년 6월 4일
카테고리
도움말 센터 및 File Exchange에서 Video Formats and Interfaces에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!