Info
La pregunta está cerrada. Vuélvala a abrir para editarla o responderla.
How to place values in vectors from a text file
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Hi,
I'm very new to Matlab, and have to find in a text some variables to store in separate vectors (a,b,c,d) to then plot and manage these data.
The input text looks like:
timestamp|tag|12 34 56 45|
timestamp|othertag|value|
timestamp|othertag2|value2|
timestamp|othertagN|valueN|
timestamp|tag|12 34 56 48|
..."
My idea is to "look" for the tag I am looking at, grab the data between the || after the specified tag, and then store each coordinate in a n_ish position of the proper coordinate vector.
But I really don't know how to even start in that.
Any help would be much appreciated.
Thanks
0 comentarios
Respuestas (1)
madhan ravi
el 9 de Oct. de 2020
Editada: madhan ravi
el 9 de Oct. de 2020
T = readtable('Test.txt', 'ReadVariableNames', 0);
C = cellfun(@(x) sscanf(x, '%d').', T{ismember(T{:, 2}, 'tag'), end},...
'un',0);
Wanted = cell2mat(C)
0 comentarios
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!