import *.dat and delete space at last column
Mostrar comentarios más antiguos
Hi all, my problem is: I want import *.txt (attach file) or *.dat to Matlab *.dat has seven columns and at in last column are numbers and sometimes text (No data) and I need delete this space so output will (Nodata). For export I use this:
number=35;
fid = fopen('zkusebni.txt', 'r' );
h2 = textscan( fid, '%s%s%s%s%s%s%s',number,'CollectOutput', true );
fclose(fid);
C2 = [h2{:}];
C2 = cat(1,h2{:});
When I export this data by my function I get one more row where is in first column is writen (Data) and other columns are empty. So my goal is: I want have same count row like previously without this parasit row (I think I have to change something in h2=textscan()). If is not my text clear look at comments I upload two *.mat what I have from import zkusebni.txt and what I want :) Thank you for your response.
4 comentarios
KSSV
el 10 de Ag. de 2017
Not clear what you want to do with the last column?
Eduard Sláma
el 10 de Ag. de 2017
Editada: Eduard Sláma
el 10 de Ag. de 2017
KSSV
el 10 de Ag. de 2017
The text file data and want_it.mat looks same.....what you want to edit there?
Eduard Sláma
el 10 de Ag. de 2017
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Data Import and Export en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!