Determining the size of an array.

Hello, thanks for helping.
I want to create an piece within my code to analyze a user input... for example.. when the user inputs a word such as 'Hello', i want to beable to analyze the size of the array? so if anyone can point me in the right direction I will be very great full. i was thinking of using a while loop to keep searching for a letters withing the array but im not 100% sure if that will work, because i then need to use the size of the array to assign values to each character.
PS. i do apologize in my terminology as i am very new to Matlab, if you have any issues in what i have said please do ask and i will try to clarify what i mean. Many thanks for the help in advance!

Answers (1)

S = 'hello'
disp(size(S))

3 Comments

Thanks for the quick reply, is it possible to use the output from 'disp(size(s))' such as the 1,5 output you above example would give?
for example using the 1,5 to take the 1st(H), 2nd(E) ,3rd(L) ,4th(L) and 5th(O) induvidualy
i tried to use
X = disp(size(S)) so i could go onto index the various letters, i know i could do this with single words, but the reason i want to do it automatically is that the size of the strings inputted will vary so i need to know the size first, i hope this makes sense too you.. may thanks by the way!
sizeOfS = size(S);
letterE = S(2);
Jan
Jan on 27 Feb 2013
Edited: Jan on 27 Feb 2013
@Tom: These questions are very basic. It is much more efficient, when you read the Getting Started chapters of the documentation, which explain the fundamental syntax and commands of Matlab exhaustively.

Sign in to comment.

Categories

Products

Asked:

Tom
on 27 Feb 2013

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!