for loop return answer in string matrix
2 次查看(过去 30 天)
显示 更早的评论
I have Ci in dimension (61x3)
and I want the ans in each row
example ans(1,1) True ans(1,2) True ans(1,3) True
This is code that I write
Ci = [Ca Cb Cc] ;
for i = 1:length(Ci),
for j = 1:3
if Ci(i,j)>0
a = 'True';
else
a = 'False';
end
fprintf ('ans %d,%d = %s\n',i,j,a);
end
end
Thank you for answer
0 个评论
回答(1 个)
另请参阅
类别
在 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!