How to suppress all the outputs during assignment of multiple variables with the same value? [To improve presentation]
조회 수: 7 (최근 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!