Borrar filtros
Borrar filtros

i want to change [3,2,4](1x3 matrix) to 324(1x1 matrix) any help?

4 visualizaciones (últimos 30 días)
i know i can do it by 3*100 + 2*20 + 4 but is there any cleaner method?

Respuesta aceptada

Guillaume
Guillaume el 16 de Nov. de 2018
Editada: Guillaume el 16 de Nov. de 2018
polyval(yourvector, 10)
would also work
But what if your vector is [30, 20, 40]?

Más respuestas (2)

Bruno Luong
Bruno Luong el 16 de Nov. de 2018
>> str2double(char([3 2 4]+'0'))
ans =
324
>>

Bruno Luong
Bruno Luong el 16 de Nov. de 2018
Editada: Bruno Luong el 16 de Nov. de 2018
This one produces NaN for overflowed data
>> polyval([3 2 4],10)
ans =
324
>> str2double(char([3 2 10]+'0'))
ans =
NaN

Categorías

Más información sobre Logical en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by