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

4 次查看(过去 30 天)
i know i can do it by 3*100 + 2*20 + 4 but is there any cleaner method?

采纳的回答

Guillaume
Guillaume 2018-11-16
编辑:Guillaume 2018-11-16
polyval(yourvector, 10)
would also work
But what if your vector is [30, 20, 40]?

更多回答(2 个)

Bruno Luong
Bruno Luong 2018-11-16
>> str2double(char([3 2 4]+'0'))
ans =
324
>>

Bruno Luong
Bruno Luong 2018-11-16
编辑:Bruno Luong 2018-11-16
This one produces NaN for overflowed data
>> polyval([3 2 4],10)
ans =
324
>> str2double(char([3 2 10]+'0'))
ans =
NaN

类别

Help CenterFile Exchange 中查找有关 Logical 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by