Binary array error message
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Basically I get the following error message:
Number of array dimensions must match for binary array op
The thing I don't understand is that, if I stop in the debugger, just before that line and run that line by writing it in the command window, it gives no problem, but then a hit F10 for the debugger to calculate that line and then I get the error message.
I am trying to simply sum two vectors of 783x1
One of the vectors, though, comes from a function which uses ASSIGNIN to create it. I don't know if that has anything to do with the error I am getting. This vector is of just 1s and 0s, the other one is just a bunch of numbers calculated just lines before.
Again, the thing I don't understand is why can I write the code and get the calculation but the program won't do it by itself.
As aditional info, if I run whos both vectors are the same size and double.
Thanks in advance.
JP
0 comentarios
Respuestas (2)
Image Analyst
el 22 de Mzo. de 2012
Can you do this in the command window when you've stopped there (before you step on the line to cause the error):
size(array1) % Note: no semicolon
size(array2) % Replace array1 and array2 with your actual array names.
Then tell us what it says. That means copy and paste it back here. Then step on the line and copy and paste the red error text back here.
0 comentarios
Juan P. Viera
el 22 de Mzo. de 2012
1 comentario
Geoff
el 22 de Mzo. de 2012
Sounds like a problem with local and global scope. If flow exists in the workspace's namespace, and you call size(flow) from your function's namespace, the inbuilt flow function will be called because your function does not have access to the workspace. In general, I would avoid using assignin() unless absolutely necessary. Where possible, use parameters to pass information into a function and return values to get information out.
Ver también
Categorías
Más información sobre Startup and Shutdown en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!