study
study

Reputation: 343

index exceeds matrix dimensions error with the size function in matlab

I have the following very simple code.

>> z=ones(4,4)

z =

     1     1     1     1
     1     1     1     1
     1     1     1     1
     1     1     1     1

>> size(z)
Index exceeds matrix dimensions.

Does anyone know why? Any comment is greatly appreciated.

Upvotes: 0

Views: 46

Answers (1)

Luis Mendo
Luis Mendo

Reputation: 112679

A likely cause is: You have a variable called size, and that variable is empty. Try clear size and then size(z).

Upvotes: 1

Related Questions