How to index filenames correctly?
7 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
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 comentarios
Respuesta aceptada
Azzi Abdelmalek
el 31 de Ag. de 2013
Editada: Azzi Abdelmalek
el 31 de Ag. de 2013
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)});
Más respuestas (0)
Ver también
Categorías
Más información sobre Matrix Indexing en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!