필터 지우기
필터 지우기

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
giorgia calisti
giorgia calisti 2019년 9월 19일
Great!! I was going mad with this error. Thank you for saving me quite some time of headbanging on the desk.
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