save as .txt file from .jpg directories
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
hi sir, can I know why it cannot save as text file? here is the script
files = dir('*.jpg');
for k = 1:numel(files)
input_name = files(k).name;
[path, name, extension] = fileparts(input_name);
output_name = fullfile(path, [name '.txt']);
save(files(k).name,'-ASCII')
end
it gives warning:
Warning: Attempt to write an unsupported data type to an ASCII file.
Variable 'structuringElement' not written to file.
Warning: Attempt to write an unsupported data type to an ASCII file.
Variable 'subImage' not written to file.
[EDITED, Jan, code and warnings formatted] Please do this by your own in the future - thanks!
0 comentarios
Respuestas (1)
Jan
el 6 de Jul. de 2012
The command save writes all variables of the current workspace to disk, if the variables are not specified. When the ASCII format is used, only a subset of the possible types is possible. E.g. how should a nested struct, which contains cell arrays, whose elements are UINT16 arrays, be written unequivocally in ASCII format?!
Either use the binary format -MAT, or specify the variables, which are written and which have the apropriate type. Read doc save for more details.
0 comentarios
Ver también
Categorías
Más información sobre Variables 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!