Quote:

Originally Posted by

**CaptainBlack** Type the commands into Matlab and see what you get.

Look at the workspace panel of the Matlab console to see what the difference is between idx1 and idx2 (I will tell you idx2 is a logical array so vec(idx2) is the array of elements of vec for which idx2 is true.

CB

Thanks CaptainBlack, I think I've got most of them now... Any idea as to what the last one is though?

Also:

(c) Write a Matlab function to count the number of positive values in an

input array.

(d) Write a Matlab function that returns

true if a matrix contains only

non-zero elements.

(e) Write a Matlab function that returns true is an input argument is not

a numerical array.

(f) There are problems with the following Matlab code.

ans = 5 + 10;

6 + 1;

% Must loop for exactly 15 elements (use ans)

for k = 0:1:ans-1

vec[k] = k;

What is wrong with this code?

Regards,