【问题标题】:Save converted image into specific path in matlab?将转换后的图像保存到matlab中的特定路径?
【发布时间】:2014-05-21 06:57:20
【问题描述】:

有人可以向我解释如何将转换后的图像(从 *.ppm 到 *.pgm)保存在 matlab 的特定目录中..

这是我的代码。

     pathName = 'D:\Matlab\Training\PGM_Files';
     % Create it if it doesn't exist.
     if ~exist(pathName, 'dir')
     mkdir(pathName);
     % This will create to the full depth of the path.
     % Upper folder levels don't have to exist yet.
     end
     fullFileName = fullfile(pathName);

     pgm_File_Images(loop1,1)=imwrite((Train_Images,['data',num2str(loop1),'.pgm']),
     fullFileName);    

我想将我的所有文件保存到文件夹 PGM_Files 中。 但是每次我出错

Expression or statement is incorrect--possibly unbalanced (, {, or [.

如何解决??

【问题讨论】:

  • 您是否阅读了错误信息?某处你的括号不匹配。
  • 当我运行该代码时,我收到错误消息 mssg“表达式或语句不正确——可能是不平衡的 (、{ 或 [。”但是我的括号已经是正确的.. 我不知道出了什么问题使用该代码
  • 作为提示:寻找一个没有[]
  • 我已经尝试过了,但还是一样
  • 您没有提供right kind of input arguments to imwrite。这就是为什么最后一个) 声称无与伦比。

标签: image matlab file-conversion


【解决方案1】:

答案已经在 cmets 中给出,因此我将在此处发布以确保问题不会一直没有答案:

您没有为 imwrite 提供正确类型的输入参数。那是 为什么最后一个 ) 声称是无与伦比的。

【讨论】:

    猜你喜欢
    • 2019-10-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-03-14
    • 1970-01-01
    • 2014-11-09
    • 1970-01-01
    相关资源
    最近更新 更多