determining if characters are alphabetic

[paraphrasing question that was edited out of existence]
I have a homework assignment. I have to use loops to figure out whether characters are alphabetic. Then I have to do the task again, but using vectorization. Please write a function for me that does this homework.

3 comentarios

Image Analyst
Image Analyst el 22 de Ag. de 2012
They're not allowed to delete once someone has responded.
steve koi
steve koi el 27 de Ag. de 2012
where can i delete question though, i cant find it anywhere. i thought it would be under edit
Jan
Jan el 27 de Ag. de 2012
Editada: Jan el 27 de Ag. de 2012
@Steve: You cannot and should not delete a question. If a student or pupil asks a homework question, it is intended, that the teachers/professors find this question together with its answers. Otherwise the forum would be full of homework cheaters.
Image Analyst has explaines this already, see above.

Iniciar sesión para comentar.

Respuestas (2)

Star Strider
Star Strider el 22 de Ag. de 2012
I suggest using isletter:
notletter = ~isletter(A);
I am not sure what you want to do, but isletter can take a string array, so in that sense it would be vectorized.

4 comentarios

steve koi
steve koi el 22 de Ag. de 2012
I have been trying to figure out the problem above using a loop. And then doing the problem again seperatley using vectorization. I need the code for both cuz I just can't figure it ouy
Star Strider
Star Strider el 22 de Ag. de 2012
Please post the code you have written, what you want your code to do, and describe why it is not working the way you want it to.
Ryan
Ryan el 22 de Ag. de 2012
Look through your notes/book/Matlab help online to figure out how to:
  • Create a function
  • Pass variables to and from the function
  • Identify data types
  • Loops and vectorization
If this is a review problem you should be able to at least provide a start to the code.
Star Strider
Star Strider el 22 de Ag. de 2012
Thank you Ryan. I agree.
Michael Richard: if you want to reverse-engineer isletter, see the documentation for isletter — particularly the links and references at the end of that documentation — and the various ways MATLAB denotes integers. This seems to be a homework assignment, so I'll leave it at that.

Iniciar sesión para comentar.

Sean de Wolski
Sean de Wolski el 27 de Ag. de 2012
s = 'Hello World it''s 1129 on Monday August 27th';
%With for-loop
for ii = 1:1
sletters = s(isstrprop(s,'alpha'));
end
%Vectorized
sletters2 = s(isstrprop(s,'alpha'));

Categorías

Más información sobre Data Type Identification en Centro de ayuda y File Exchange.

Preguntada:

el 22 de Ag. de 2012

Community Treasure Hunt

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

Start Hunting!

Translated by