How would I delete rows in a tall matrix to make it into a square matrix?

2 visualizzazioni (ultimi 30 giorni)
How would I delete rows in a tall matrix to make it into a square matrix? When given a tall matrix, what can I run to turn that tall matrix into a square matrix?

Risposte (1)

Arif Hoq
Arif Hoq il 4 Feb 2022
If i am right then....
Tall matrix, if m>n here m= row, n= column
Wide matrix, if m<n
Square matrix, if m=n
So, i think you have to add column to convert into square matrix from tall matrix, not deleting row.
m=4; % row
n=3; % column
tall_matrix=randi(10,m,n);
add_col= randi(10,n+1,1);
square_matrix= [tall_matrix add_col]
square_matrix = 4×4
10 8 3 10 8 1 10 2 6 7 4 10 4 7 7 9

Categorie

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

Prodotti


Release

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by