且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在函数的输出上使用索引?

更新时间:2023-12-04 14:10:52

如果您仍然想知道,请考虑以下示例:

In case you are still wondering, consider this example:

%# some function that returns a cell array (TEXTSCAN in your case)
myFunc = @() {rand(5,5)};

%# normally you would write
C = myFunc();
C = C{1,1};

这是

Here is the cellarray-version of @gnovice answer in the linked question (ugly but works):

%# equivalent to: C = myFunc(){1,1}
C = subsref(myFunc(), struct('type','{}','subs',{{[1 1]}}))