Binary array error message
1 次查看(过去 30 天)
显示 更早的评论
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 个评论
回答(2 个)
Image Analyst
2012-3-22
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 个评论
Juan P. Viera
2012-3-22
1 个评论
Geoff
2012-3-22
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.
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!