How to suppress all the outputs during assignment of multiple variables with the same value? [To improve presentation]
8 ビュー (過去 30 日間)
古いコメントを表示
X = imread('parrot.jpg');
R,G,B = X;
I am trying to assign multiple variables (here; R, G & B) with the same value (i.e., X). A semicolon is put to suppress the resulting matrix outputs. However, the matrix of R and G are not getting supressed; only the B one's is.
How should I code that all the outputs are getting suppressed?

0 件のコメント
採用された回答
Sachin Motwani
2020 年 8 月 21 日
1 件のコメント
Bruno Luong
2020 年 8 月 21 日
This will be equivalent to assign
R = X;
G = X;
B = X;
I don't think thiis is OP's intention.
その他の回答 (1 件)
Bruno Luong
2020 年 8 月 21 日
X = imread('parrot.jpg');
X = num2cell(X,[1 2]);
[R,G,B] = deal(X{:});
Or simply
X = imread('parrot.jpg');
R = X(:,:,1);
G = X(:,:,2);
B = X(:,:,3);
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Logical についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!