if" function in matrix elements
1 回表示 (過去 30 日間)
古いコメントを表示
please help, i got quesion of matrix and if condition.
If G=any matrix with two columns.
if one of the numbers in G is equal or less than 1,
C=A+B
elseif if two of the numbers in G is equal or less than 1,
C=A-B.
How to create this condition?
please help. any help will be appreciated.
Thanks Jagadesh Rao Thalur
0 件のコメント
採用された回答
Roger Stafford
2014 年 11 月 2 日
s = sum(G(:)<=1);
if s == 1
C = A+B
elseif s == 2
C = A-B
else
??? What do you want to happen if either none or else more than two have this property?
end
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Creating and Concatenating Matrices についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!