Union two matrix of nxn, how?

3 次查看(过去 30 天)
i have a data like this
mdfl_dc_1 =...
[85 97 109 121 133 145 157 169 181
43 0 0 0 33 0 0 0 0
22 0 0 0 122 0 0 0 0
0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0]
mdfl_ic_1 =
85 97 109 121 133 145 157 169 181
60 0 0 0 0 0 0 0 0
55 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0
i want to union this two matrices in the shape on (...,1) and after that i want to remove zero value. how to do this?

采纳的回答

Eric Delgado
Eric Delgado 2022-11-18
Try this...
mdfl_dc_1 = [85 97 109 121 133 145 157 169 181; ...
43 0 0 0 33 0 0 0 0; ...
22 0 0 0 122 0 0 0 0; ...
0 0 0 0 0 0 0 0 0; ...
0 0 0 0 0 0 0 0 0];
mdfl_ic_1 = [85 97 109 121 133 145 157 169 181; ...
60 0 0 0 0 0 0 0 0; ...
55 0 0 0 0 0 0 0 0; ...
0 0 0 0 0 0 0 0 0; ...
0 0 0 0 0 0 0 0 0];
MDFL = [reshape(mdfl_dc_1, [numel(mdfl_dc_1), 1]); ...
reshape(mdfl_ic_1, [numel(mdfl_ic_1), 1])];
MDFL = MDFL(MDFL~=0)
MDFL = 24×1
85 43 22 97 109 121 133 33 122 145

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Matrices and Arrays 的更多信息

产品


版本

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by