Error in function unreproducible in dugger.

3 ビュー (過去 30 日間)
Val Schmidt
Val Schmidt 2015 年 10 月 23 日
回答済み: Val Schmidt 2015 年 10 月 23 日
I'm stumped and need some help.
I've the following simple statement:
pp = ([cc(1) Iinf.Width-cc(2)]) - floor([Iinf.Height/2 Iinf.Width/2]);
which subtracts two 1x2 matrices. When I execute this within a function, I get an error:
Error using - Matrix dimensions must agree.
But if I set 'dbstop on error', and then attempt to re-execute the line after the error and stop in the program, it executed cleanly. Or if I set a break point at that point, and then execute it by clicking 'step' it will fail, but if I select the line and R-click->evaluate, it executed cleanly. If I check the size of each matrix they both report 1x2. I can't figure out what's going on or how to debug it.
  1 件のコメント
Sean de Wolski
Sean de Wolski 2015 年 10 月 23 日
Can you post the whole function to reproduce it?

サインインしてコメントする。

回答 (2 件)

Image Analyst
Image Analyst 2015 年 10 月 23 日
Put these lines before that line:
Iinf.Height
Iinf.Width
message = sprintf('Height = %f\nWidth = %f', Iinf.Height, Iinf.Width)
uiwait(helpdlg(message));
What do yo usee popup and what do you see in the command window?

Val Schmidt
Val Schmidt 2015 年 10 月 23 日
I found the error. In another toolbox there is a function called cc.m, which was colliding with the variable defined as cc.
Changing the variable name fixed the problem.

カテゴリ

Help Center および File ExchangeDebugging and Analysis についてさらに検索

タグ

製品

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by