Shifting columns in matrix Matlab
Ältere Kommentare anzeigen
Dear members,
I have a matrix in which its tril and triu are zeros
And I want to shift up its rows
How can I program it in Matlab please?
3 Kommentare
Walter Roberson
am 12 Feb. 2021
Probably adding transposed tril and triu
the cyclist
am 12 Feb. 2021
What is in the matrix locations that are "empty" in your top image of H. (An element of a numeric array cannot be empty.)
Can you upload the matrix H in a MAT file?
Afluo Raoual
am 12 Feb. 2021
Akzeptierte Antwort
Weitere Antworten (1)
Nora Khaled
am 12 Feb. 2021
clear all;
clc
H=[0 0 0 0 0 0 0 0 0 0
0 1 1 1 0 0 0 0 0 0
1 1 1 0 0 1 0 0 0 0
1 0 0 1 1 0 0 1 0 0
1 1 0 0 1 1 1 0 0 1
0 0 1 1 1 0 1 1 1 0
0 0 0 0 0 1 0 0 1 1
0 0 0 0 0 0 1 1 0 0
0 0 0 0 0 0 0 0 1 1];
[~,c]=size(H);
j=0;
M=[];
for i=1:2:c
j=j+1;
M=[M H(j:j+4,i:i+1)];
end
1 Kommentar
Afluo Raoual
am 13 Feb. 2021
Kategorien
Mehr zu Logical finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!