I'm having a hard time figuring out the for loop command. I want to create a .m file that will prompt a user to enter an array and then be able to identify positive and negative numbers or numbers equal to zero. But I'm not sure how to create the for loop command for this.
I know how to get the prompts in the program file but that's about all I'm getting to. I've been reading through a Matlab book and searching online but with no success. It's hard to teach yourself this stuff!
An example of what I would like to do is:
input('Enter the number of elements in a vector: ') v=input('Enter the array: ')
Now all I would like to do is set this up. I know my commands would be something like:
v<0 and v>0 % to get my negative and positive numbers
and v=0: to get what ever is equal to zero.
But how would I set this up using a for loop?
Best Answer