MATLAB:传递单元参数

MATLAB:传递单元参数,matlab,Matlab,我有一个功能: function myFunc(myStruct) % file can contains one or a list of files file = {fullfile(pwd,myStruct.name)} end 从另一个文件调用myFunc时 myStruct.name = {'toto','titi','tata'} myFunc(myStruct); I got an error ,function isn't definied for cell

我有一个功能:

function myFunc(myStruct)
    % file can contains one or a list of files
    file = {fullfile(pwd,myStruct.name)}
end
从另一个文件调用myFunc时

myStruct.name = {'toto','titi','tata'}
myFunc(myStruct);

I got an error ,function isn't definied for cell 
我想将字符串或字符串列表传递到myStruct.name字段: 我的意思是myStruct.name可以接受一个参数'toto'或参数列表{'toto','titi'}

什么时候

我怎么能这么做


谢谢

最后我们有一个完整的问题


仔细阅读例外情况,你是如何提出问题的,这说明你不理解它。例外情况是,
fullfile
没有为单元格输入定义,这只是事实。您必须为每个应该生成的文件夹调用
fullfile
,因此需要一个for循环,其中包含
file{idx}=fullfile(pwd,myStruct.name{idx})

您希望函数如何处理该列表?它会返回什么?我只想说myStruct.name可以访问字符串或字符串列表,但“接受”它做什么?例如,空函数将接受任何内容作为其输入@萝拉:预期的输出是什么?三个子文件夹的列表?子文件夹/toto/titi/tata?子文件夹ToToToTitata?参数的任何其他组合?struct myStruct.name的feiel可以访问字符串或字符串列表,我的意思是,当我指定myStruct.name={'toto','titi'}然后调用myFunc(myStruct)时,它可以从另一个文件访问