Problem
magic(5)(3)
Solution 1
value = subsref(magic(5),struct('type','()','subs',{{3,3}}));
Solution 2
paren = @(x, varargin) x(varargin{:});
paren(magic(5), 3, 3);
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
3 Comments
Direct link to this comment
https://www.mathworks.com/matlabcentral/answers/78242-indexing-of-fresh-array-in-one-line-without-intermediate-variable#comment_153344
Direct link to this comment
https://www.mathworks.com/matlabcentral/answers/78242-indexing-of-fresh-array-in-one-line-without-intermediate-variable#comment_153344
Direct link to this comment
https://www.mathworks.com/matlabcentral/answers/78242-indexing-of-fresh-array-in-one-line-without-intermediate-variable#comment_153346
Direct link to this comment
https://www.mathworks.com/matlabcentral/answers/78242-indexing-of-fresh-array-in-one-line-without-intermediate-variable#comment_153346
Direct link to this comment
https://www.mathworks.com/matlabcentral/answers/78242-indexing-of-fresh-array-in-one-line-without-intermediate-variable#comment_504862
Direct link to this comment
https://www.mathworks.com/matlabcentral/answers/78242-indexing-of-fresh-array-in-one-line-without-intermediate-variable#comment_504862
Sign in to comment.