I was using ind2sub with a 2D matrix (IND) for a matrix of 2D size and only supplied one output (ans).
Example:
>> ind2sub([3,3], [2,2,2; 3,3,3]);
The function is supposed to have an output of something like
[A,B] = ind2sub(...
however I wanted to use it in the middle of a line, where there is only one output matrix. As it is now, the output of the above example function is [2,2,2; 3,3,3].
My question is if ind2sub could have the added functionality so that if there is only one output matrix, the output matrices could be combined into the first non-utilized dimension. In the example (and in my case) the third dimension (Ex. size(ind2sub(…)) = [2,3,2]).
Have a good day,
Jude
Best Answer