Convert decimal number to vector

前端 未结 3 1250
一向
一向 2021-01-29 00:16

In matlab I want to convert this:

12345.6788993442355456789

into a vector

[1 2 3 4 5 6 7 8 8 9 9 3 4 4 2 3 5 5 4 5 6 7 8 9]
         


        
3条回答
  •  情歌与酒
    2021-01-29 00:56

    Not familiar with Matlab syntax but if you

    • convert the number to a string
    • loop through each character and add the digit to the vector if the character is not the decimal point

    that would work. There are probably more efficient ways to do this.

提交回复
热议问题