开发者

Convert character array to string in MATLAB

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_inpu开发者_JAVA技巧ts at 491
The filename or url argument must be a string.

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

And it's my matrix:

Convert character array to string in MATLAB


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜