How to remove many NAN rows

1 visualización (últimos 30 días)
Raquel Fernández Sánchez
Raquel Fernández Sánchez el 9 de Abr. de 2018
Respondida: Raquel Fernández Sánchez el 12 de Abr. de 2018
Hello. I´m new to Matlab and I can´t solve the next syntax problem. That is: I have 4 files (.dat). Each one contents a variable number of rows but all of them have 6 columns. What I want is removing 21st rows of each document (which are NAN, by the way) and join them into one file. Can you help me?
Thanks in advance

Respuesta aceptada

Gayatri Menon
Gayatri Menon el 12 de Abr. de 2018
Hi,
Hope the below example helps.
Let the matrix A=[1 2 3;4 5 6;NaN,NaN,NaN].If you want to remove the 3rd row of this matrix, you could use the following command
A(3,:)=[];
In order to concatenate the matrices vertically, 'vertcat' command can be used.
Please refer the below documentation on vertcat:
Thanks

Más respuestas (1)

Raquel Fernández Sánchez
Raquel Fernández Sánchez el 12 de Abr. de 2018
Thanks a lot Gayatri.Vertcat command successfully solves the concatenate's problem. Im relation to removing rows. Could I write A(1:21,:)=[]; in order to delete a range of rows(from 1 to 21)?

Categorías

Más información sobre Creating and Concatenating Matrices en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by