a=[0 0 0; 0 0 0; 1 2 3; 4 5 6]

3 件のコメント

Rik
Rik 2021 年 10 月 26 日
What have you tried so far?
LeoAiE
LeoAiE 2021 年 10 月 26 日
編集済み: LeoAiE 2021 年 10 月 26 日
a=[0 0 0; 0 0 0; 1 2 3; 4 5 6]
a = 4×3
0 0 0 0 0 0 1 2 3 4 5 6
a(a>0) % the results would be a column vector
ans = 6×1
1 4 2 5 3 6
% Or try to remove the row or the columns with zeros
a(1:2,:) = []
a = 2×3
1 2 3 4 5 6
a
a = 2×3
1 2 3 4 5 6
Rik
Rik 2021 年 10 月 27 日
@Aladdin, this is an answer to what might be a homework question. Please consider either moving your comment to the answer section (by deleting this and reposting it) or deleting your comment.

サインインしてコメントする。

回答 (1 件)

Walter Roberson
Walter Roberson 2021 年 10 月 27 日

0 投票

a = [0 0 0; 0 0 0; 1 2 3; 4 5 6]
a = 4×3
0 0 0 0 0 0 1 2 3 4 5 6
b = rmmissing(standardizeMissing(a, 0))
b = 2×3
1 2 3 4 5 6

カテゴリ

質問済み:

2021 年 10 月 26 日

回答済み:

2021 年 10 月 27 日

Community Treasure Hunt

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

Start Hunting!

Translated by