"For colon operator with char operands, first and last operands must be char." error?
59 visualizzazioni (ultimi 30 giorni)
a and b are integer numbers that change on each iteration of n
The code is meant to set some zeros in a zero matrix to 1
On the 2nd iteration, i.e. n=2, I keep getting the following error:
"For colon operator with char operands, first and last operands must be char."
Guillaume il 25 Feb 2015
According to the error message, a and b are integer numbers is not true. I suspect that a is actually of type char and b may be integer, which would result in a+b being integer.
Without knowing more about a and b, it's hard to help you, so post the code that generate them.
You can check the type of a and b when you get the error by writing
dbstop if error
at the comment prompt before running your loop / program. Matlab will break into the debugger when it encounters the error. At which point you can issue
whos a b
to see their type.