error with results, matlab
古いコメントを表示
Where is error? My program showed my only WYKRYTO, but I don't know what.
fprintf('\nWYKRYTO: ');
if (kaszel == max([kaszel, smiech, krzyk, chrzakanie]))
fprintf('kaszel');
elseif (smiech == max([kaszel, smiech, krzyk, chrzakanie]))
fprintf('smiech');
elseif (krzyk == max([kaszel, smiech, krzyk, chrzakanie]))
fprintf('krzyk');
elseif (chrzakanie == max([kaszel, smiech, krzyk, chrzakanie]))
fprintf('chrzakanie');
end
13 件のコメント
Matt J
2014 年 1 月 21 日
Works fine for me.
AJ von Alt
2014 年 1 月 21 日
What are the values of kaszel, smiech, krzyk, and chrzakanie ?
Your programs seems to work properly when I set them to random values.
You should also add a fprintf('\n') after end to improve readability.
Monika
2014 年 1 月 21 日
Walter Roberson
2014 年 1 月 21 日
Are they strings?
Patrik Ek
2014 年 1 月 21 日
Is the code in your script identical with the code in the question? Including new lines and so? In that case you need to add 3 dots after each comma where you start writing on next line. Otherwise MATLAB assumes a matrix
[1 2 3; 4]
Which have wrong dimensions.
Walter Roberson
2014 年 1 月 21 日
What is class(kaszel) ?
Monika
2014 年 1 月 21 日
Walter Roberson
2014 年 1 月 21 日
What is class(kaszel) ? Run your program and at the end of that section
disp(class(kaszel))
and tell us what the output was.
Monika
2014 年 1 月 21 日
Walter Roberson
2014 年 1 月 21 日
Please show
size(kaszel), size(smiech), size(krzyk), size(chrzakenie)
Monika
2014 年 1 月 21 日
編集済み: Walter Roberson
2014 年 1 月 21 日
Monika
2014 年 1 月 21 日
編集済み: Walter Roberson
2014 年 1 月 22 日
採用された回答
その他の回答 (2 件)
Azzi Abdelmalek
2014 年 1 月 21 日
Maybe you want
fprintf('\\nWYKRYTO: ');
3 件のコメント
Monika
2014 年 1 月 21 日
Azzi Abdelmalek
2014 年 1 月 21 日
If you give some data we can test your code.
Monika
2014 年 1 月 21 日
編集済み: Walter Roberson
2014 年 1 月 21 日
per isakson
2014 年 1 月 21 日
0 投票
2 件のコメント
Matt J
2014 年 1 月 21 日
Hard to imagine that applies to max() operations. I'm not encountering issues, at least.
per isakson
2014 年 1 月 22 日
編集済み: per isakson
2014 年 1 月 22 日
Agree, but it's a good habit not to use "==" with floats.
カテゴリ
ヘルプ センター および File Exchange で MATLAB についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
