Filter löschen
Filter löschen

How add field to a import structure file *.txt.?

1 Ansicht (letzte 30 Tage)
Biza Ferreira
Biza Ferreira am 18 Sep. 2022
Kommentiert: Biza Ferreira am 24 Sep. 2022
Hello fellows I have a problem I need to add a field to a import text file.
I have some field's in a .txt file i need to use , but I need to add a new fields to structure, can someone help me with this?
Thanks in advance
fileID = fopen(fullfile( FilePath, FileName),"r");
%RELOAD FILE DATA IN MATRIX FORMAT WITH ALL COLUMNS
dataAcquisition = readmatrix(fullfile(FilePath,FileName),'NumHeaderLines',headerLine);
%CHOOSE THE COLUMN's WITH THE DATA NEEDED
ixKeep=[1 2:7]
%LOAD ALL REQUIRED FIELDS
dataAcquisition = dataAcquisition(:,ixKeep);
%%%%%%%%%%%%%ADD STRUCTURE WITH A FOLLOWING FIELDS%%%%%%%%%%%%%%
%SAMPLE | TIMESAMPLE | ECG | RESPIRATORY | TEMPERATURE | BATTERY
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
validFields = {'sample', 'time_aquisition', 'ecg', 'respiratory', 'temperature', 'baterry'}
  2 Kommentare
Chunru
Chunru am 19 Sep. 2022
You are using readmatrix to get a matrix (rather than a structure). You can add in new culumn to the matrix but not field.
Biza Ferreira
Biza Ferreira am 24 Sep. 2022
Once the "dataAquisition" variable represent a import file matrix, from *.txt file, i need associate each field of the following array (validFields), to each column of INPUT.txt file.
In the first column i need made a count eac sample until reache the total of samples(this to garant all samples are readed).
On de second column whant increment each sample time aquisition that is preformed at each 0.008s( t= 1/fs).
can anyone give me some support?
Thanks in advance

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Kategorien

Mehr zu Get Started with MATLAB finden Sie in Help Center und File Exchange

Tags

Produkte


Version

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by