Matrix operations
3 ビュー (過去 30 日間)
古いコメントを表示
i have an n by i matrix call it B. I want to apply two different operations to B. I want to perform the first operation on elements of B<0 and then perform the other operation to the rest of B. The operations themselves are n by n matrices. How do i do it please?
0 件のコメント
回答 (1 件)
Titus Edelhofer
2011 年 7 月 25 日
Hi,
use logical indexing:
idx = B<0;
% operate on these indices:
B(idx) = ...;
% and now on those >= 0:
B(~idx) = ...;
Titus
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Resizing and Reshaping Matrices についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!