码迷,mamicode.com
首页 > 其他好文 > 详细

Convert character array to string in MATLAB

时间:2014-11-16 20:03:43      阅读:153      评论:0      收藏:0      [点我收藏+]

标签:ar   sp   文件   on   bs   ad   ef   as   tt   

Matlab提取特征值是经常要读取多个图片文件,把文件名保存在数组中后再读取会出错。从stackoverflow中找到如下解决方法:

I‘ve a M by N matrix, each cell contains a character array, that is an image path. How can I use it to read image? It should be string.

It‘s what I try to do:

imread(fl(1,1));
??? Error using ==> imread>parse_inputs at 491
The filename or url argument must be a string.

Error in ==> imread at 336
[filename, fmt_s, extraArgs, msg] = parse_inputs(varargin{:});

Replace fl(1,1) with fl{1,1}. You access the contents of a cell-array with {}. You access the cell element itself with ().

Since imread expects a string and not a cell element, it throws that error.

 

Convert character array to string in MATLAB

标签:ar   sp   文件   on   bs   ad   ef   as   tt   

原文地址:http://www.cnblogs.com/lakeone/p/4101725.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!