Info

La pregunta está cerrada. Vuélvala a abrir para editarla o responderla.

How do I turn multi-digit value to a multi-elemented vector/string/matrix?

1 visualización (últimos 30 días)
alex
alex el 18 de Oct. de 2015
Cerrada: MATLAB Answer Bot el 20 de Ag. de 2021
To elaborate, say, the value is value=112.
I want it to give me s=2 when I command s=value(end). Using plain number-to-vector commands make 112 remain as a single element, a 1x1 matrix. I want it to be a 3x1 matrix.
I use MATLAB R2014b.
  3 comentarios
alex
alex el 18 de Oct. de 2015
num2str and int2str are examples. Another one that turns values into ASCII, but I won't be needing that since I'll be comparing last digits of the number for an if command.
Stephen23
Stephen23 el 18 de Oct. de 2015
Editada: Stephen23 el 25 de Oct. de 2015
Neither int2str nor num2str "make 112 remain as a single element, a 1x1 matrix": in fact given your trial value they both create a 1x3 string:
>> size(num2str(112))
ans =
1 3
>> size(int2str(112))
ans =
1 3
Can you please show how you were using them and managed to create a 1x1 matrix.

Respuestas (1)

Walter Roberson
Walter Roberson el 18 de Oct. de 2015
mod(value, 10)

Etiquetas

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by