Union two matrix of nxn, how?

3 Ansichten (letzte 30 Tage)
M Adli Hawariyan
M Adli Hawariyan am 18 Nov. 2022
Beantwortet: Eric Delgado am 18 Nov. 2022
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?

Akzeptierte Antwort

Eric Delgado
Eric Delgado am 18 Nov. 2022
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

Weitere Antworten (0)

Kategorien

Mehr zu Matrices and Arrays finden Sie in Help Center und File Exchange

Produkte


Version

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by