For example, if I want to read the middle value from magic(5)
, I can do so like this:
M = magic(5);
value = M(3,3);
to get value == 13
. I'd like to be able to do something like one of these:
value = magic(5)(3,3);
value = (magic(5))(3,3);
to dispense with the intermediate variable. However, MATLAB complains about Unbalanced or unexpected parenthesis or bracket
on the first parenthesis before the 3
.
Is it possible to read values from an array/matrix without first assigning it to a variable?
testmatrix('magi', 5)(3, 3)
on Scilab andmagic(5)(3, 3)
on Octave both work like a charm! – Langobardic