Ask your own question, for FREE!
Computer Science 10 Online
OpenStudy (anonymous):

What does this error in MATLAB mean? Attempted to access z(4); index out of bounds because numel(z)=2.

OpenStudy (anonymous):

numel gives you the NUMber of ELements. If numel(z) is two, then there is no element z(4), only elements z(1) and z(2). That's why it says index out of bounds. The index (which is 4) does not fit between the bounds of 1 and 2.

OpenStudy (anonymous):

How do I create elements z(3) and z(4) then?

OpenStudy (anonymous):

Of course, it depends on what kind of data you want in them. If you want them zero, you could just say `z(3:4) = 0;`

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!