count rows from column file and store in a new column
Show older comments
someone could help me to see how to make a column that increases in numbers according to the number of entries from a column file?
I have this matrix: A = [1,2,3,4,5 ; 5,5,5,5,5; 5,5,5,5,5; 5,5,5,5,5; 5,5,5,5,5 ] and i want to add new column with number of each file.
and add this column to an existing file .
Answers (1)
Ameer Hamza
on 31 Oct 2020
Edited: Ameer Hamza
on 31 Oct 2020
If both matrices have the same number of rows, then you can combine them using concatenation brackets ([]). For example
A = [1,2,3,4,5 ; 5,5,5,5,5; 5,5,5,5,5; 5,5,5,5,5; 5,5,5,5,5 ];
B = rand(5, 10); % random matrix
C = [A B] % join A and B
Categories
Find more on Creating and Concatenating Matrices in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!