num2str bug with matrices

num2str bug with matrices - num2str error with certain matrices - Messages

#1 Posted: 1/7/2013 7:13:47 PM
sublim21

sublim21

3 likes in 36 posts.

Group: User

Hey all,

I was trying to write a variable type detection script, so i can know if a variable is a number, matrix, string etc.

Everything was working until i tried num2str matrices.

Most work:


num2str(mat("b",1,1)) =



However, if an entry in the matrix contains a space or other special character, an error occurs.

num2str(mat(" b",1,1)) =

**EDIT UPDATE - The original post stated that only leading spaces would result in an error. This is incorrect. Any space in the matrix entry results in an error.


Any help in this regard is greatly appreciated.

-Pete
#2 Posted: 1/7/2013 9:16:16 PM
Davide Carpi

Davide Carpi

1415 likes in 2872 posts.

Group: Moderator

Wrote

Hey all,

I was trying to write a variable type detection script, so i can know if a variable is a number, matrix, string etc.

Everything was working until i tried num2str matrices.

Most work:


num2str(mat("b",1,1)) =



However, if the leading character in the text is a space or other special character, an error occurs.

num2str(mat(" b",1,1)) =

There is no error if the text ends in a space, or other special character.

num2str(mat("b ",1,1)) =


Any help in this regard is greatly appreciated.

-Pete



I can confirm (it's a known bug)


regards,

w3b5urf3r
If you like my plugins please consider to support the program buying a license; for personal contributions to me: paypal.me/dcprojects
  • New Posts New Posts
  • No New Posts No New Posts