new to matlab, I am tring to write a peice of code that accepets two premanitars and displys all numbers that have a digit equal to ‘2’ .
Mostrar comentarios más antiguos
This seems like a fairly simple concept but how can i write this so that only number with digits of 2 are displayed. Reading around i found that %c will look for specific characters but i don't understand how to use it. Any help or direction on this matter is apperecated.
2 comentarios
Image Analyst
el 11 de Jun. de 2013
What is a "premanitar"?
Kwen
el 13 de Jun. de 2013
I think they meant parameter.
Respuestas (1)
Sean de Wolski
el 11 de Jun. de 2013
%example x
x = [17.5;12.3;132;211;3.1419];
%convert to string
xstr = num2str(x);
%any column has a digit 2
idx = any(xstr=='2',2);
%Extract from x
x(idx)
Welcome to MATLAB and Answers!
1 comentario
nicholes
el 11 de Jun. de 2013
Categorías
Más información sobre Startup and Shutdown en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!