Union two matrix of nxn, how?

3 visualizzazioni (ultimi 30 giorni)
M Adli Hawariyan
M Adli Hawariyan il 18 Nov 2022
Risposto: Eric Delgado il 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?

Risposta accettata

Eric Delgado
Eric Delgado il 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

Più risposte (0)

Categorie

Scopri di più su Matrices and Arrays in Help Center e File Exchange

Prodotti


Release

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by