How to suppress all the outputs during assignment of multiple variables with the same value? [To improve presentation]

4 次查看(过去 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?

采纳的回答

Sachin Motwani
Sachin Motwani 2020-8-21
We can use the function following:
deal()
Useage:
X = imread('parrot.jpg');
[R, G ,B] = deal(X);
Source:

更多回答(1 个)

Bruno Luong
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);

类别

Help CenterFile Exchange 中查找有关 Logical 的更多信息

标签

产品


版本

R2019a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by