Read Text files, subtract the columns of the text file and same in same text file.
9 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Hi everyone,
How do i read multiple text files, subtract column 2 from 5, column 3 from 6, column 4 from 7 and write the the output in same file to column 8, 9 and 10 respectively.
1 comentario
Rik
el 16 de Dic. de 2021
Write the code for a single file, then use a loop. What did you try already?
Respuestas (1)
Voss
el 16 de Dic. de 2021
To do the arithmetic and storing the result in the same matrix, you can do something like this:
data = randn(100,7); % I'm making up some random data here. Your data will come from your text file.
data(:,[8 9 10]) = data(:,[5 6 7]) - data(:,[2 3 4]); % do column 5 minus column 2, store result in column 8, etc.
0 comentarios
Ver también
Categorías
Más información sobre Text Files en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!