I have tried everything and I have no luck.
3 次查看(过去 30 天)
显示 更早的评论
fsadf
1 个评论
James Tursa
2016-10-4
Please show what you have done so far, and ask specific questions about where you are having problems.
回答(1 个)
Sima
2016-10-4
What have you tried?
You don't need a loop in Matlab, length(find(X>10)) will give you the number of elements in X that are greater than 10.
disp will display whatever string you give it and mat2str will convert any matrix to a string.
2 个评论
Sima
2016-10-4
it's not as efficient but you can do:
larger_than_ten=0;
for i=1:length(X)
if (X(i)>10)
larger_than_ten=larger_than_ten+1;
end
end
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Loops and Conditional Statements 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!