num2str bug with matrices

num2str bug with matrices - num2str error with certain matrices - Сообщения

#1 Опубликовано: 07.01.2013 19:13:47
sublim21

sublim21

3 сообщений из 36 понравились пользователям.

Группа: 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 Опубликовано: 07.01.2013 21:16:16
Davide Carpi

Davide Carpi

1417 сообщений из 2873 понравились пользователям.

Группа: 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
  • Новые сообщения Новые сообщения
  • Нет новых сообщений Нет новых сообщений