How to index filenames correctly?
7 ビュー (過去 30 日間)
古いコメントを表示
Please help if you have the answer.
I have .png images, which I want to read randomly and send to a function which will perform segmentation and then output the answer in a xls file or csv... But I doing the indexing in the beginning wrong. Here is what I want to do.
store files in Images:
Images=['image001.png'; 'image003.png'; 'image020.png';'image022.png';'image024.png';'image025.png'; 'image026.png';'image027.png';'image028.png';'image029.png';
'image035.png';'image036.png';'image038.png';'image042.png']
Then by choice have the index as follow:
Items=[1 2 5 6 9 12];
I want the 1st, the 2nd, 5th etc...
Then run a loop
for k=1:size(Items,1)
[A,n] = Calc_Exudate(Images(Items(k)));
%append A n to xls or csv
dlmwrite('data.csv',[mat2str(A') ',' num2str(n)],'delimiter',',','-append');
end
With this code it select "i", because that is the 1st letter, but I want the whole file/item.
0 件のコメント
採用された回答
Azzi Abdelmalek
2013 年 8 月 31 日
編集済み: Azzi Abdelmalek
2013 年 8 月 31 日
Use
[A,n] = Calc_Exudate(Images(Items(k),:));
% or use a cell array
Images={'image001.png';'image003.png';'image020.png';'image022.png'}
[A,n] = Calc_Exudate(Images{Items(k)});
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Matrix Indexing についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!