zoukankan      html  css  js  c++  java
  • Convert character array to string in MATLAB

    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.

     
  • 相关阅读:
    ElasticSearch-生命周期管理
    Alpha 冲刺五
    Alpha 冲刺四
    Alpha 冲刺三
    Alpha 冲刺二
    Alpha 冲刺一
    测试随笔
    校友录
    项目需求分析(淘校)
    团队选题报告(淘校)
  • 原文地址:https://www.cnblogs.com/lakeone/p/4101725.html
Copyright © 2011-2022 走看看