save as .txt file from .jpg directories

3 ビュー (過去 30 日間)
Tulips
Tulips 2012 年 7 月 6 日
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!

回答 (1 件)

Jan
Jan 2012 年 7 月 6 日
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.

カテゴリ

Help Center および File ExchangeCharacters and Strings についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by