Error when calling function from GUI
古いコメントを表示
This happens when i assigned calling of the function from a gui. It operated fine if i just simply call the function in command line.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
case 'Correlation',
disp(sCr(i,j))
disp(CrVa)
k=sCr(i,j)-CrVa
the computation gives:
0.5616
0.9988
k =
-47.4384 -45.4384 -56.4384 -56.4384 -55.4384 -55.4384
0.5491
0.9988
k =
-47.4509 -45.4509 -56.4509 -56.4509 -55.4509 -55.4509
%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1 件のコメント
Image Analyst
2012 年 2 月 19 日
Why was sCr(i,j) not printed out in the second case??? Also, can you print out more decimal places, in case there are differences beyond 4 decimal places:
fprintf('%.9f\n', sCr(i,j));
採用された回答
その他の回答 (2 件)
eng keong
2012 年 2 月 19 日
3 件のコメント
Image Analyst
2012 年 2 月 19 日
OK, so now you learned that sCr(i,j) is different on each run, and because of this you get different values for k on each run. But you have not explained what the error is. Do you have an error message spit out by MATLAB, or did you just think that k should be the same each time even if it subtracts different things each time?
eng keong
2012 年 2 月 19 日
eng keong
2012 年 2 月 19 日
Image Analyst
2012 年 2 月 19 日
0 投票
Do you know how to use the debugger? Can you put a breakpoint there and hover over each of the terms in your k line and tell me it they are .56 and .9988? Chances are that CrVa is not a single number with value .9988 and that it is an array, and that you are not posting your full code.
カテゴリ
ヘルプ センター および File Exchange で Logical についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!