Borrar filtros
Borrar filtros

save as .txt file from .jpg directories

3 visualizaciones (últimos 30 días)
Tulips
Tulips el 6 de Jul. de 2012
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!

Respuestas (1)

Jan
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.

Categorías

Más información sobre Characters and Strings en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by