Possible Duplicate:
How can I index a MATLAB array returned by a function without first assigning it to a local variable?
I'm having to build matrices using one of the built in matlab commands and then get a submatrix. For example:
I = eye(10)
I = I(:,2:4)
in order to get columns 2, 3, and 4 of the eye(10) matrix. It's becoming annoying to use two lines and two assignments for something like this, but the following statements are illegal:
I = eye(10)(:,2:4)
and
I = (eye(10))(:,2:4)
Why is this? Is there something in matlab's grammar that would cause ambiguities to arise if such statements were allowed?