Could someone help me with the "imwrite" command please ? Error using imwrite>parse_inputs (line 541) The colormap should have three columns.

8 次查看(过去 30 天)
ImageData = imread(Result{1}(i).raw_list.z);
imwrite(ImageData , strcat("C:\Users\toto\Documents\SP4\Camera_Images\", num2str(i), '.png'), 'png');

采纳的回答

Guillaume
Guillaume 2018-7-20
The error message is misleading. The problem is that, surprisingly, imwrite does not yet support string arrays for the filename.
Change your double quotes to single quotes and all should be well
imwrite(ImageData , strcat('C:\Users\toto\Documents\SP4\Camera_Images\', num2str(i), '.png'), 'png');
Or rather than using strcat + num2str, use sprintf:
imwrite(ImageData , sprintf('C:\Users\toto\Documents\SP4\Camera_Images\%d.png', i), 'png');
  2 个评论
Guillaume
Guillaume 2019-9-19
Note that support for strings in imwrite was implemented in R2018b, so if you're using a recent version of matlab, this answer is no longer relevant.

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Image Processing Toolbox 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by