Using filenames to name timetables

1 Ansicht (letzte 30 Tage)
Karin Kvickström
Karin Kvickström am 4 Sep. 2020
Beantwortet: Deepak Meena am 7 Sep. 2020
Hi,
I have a number of files apples.txt, orange.txt, pear.txt (+ a lot more). Each file is a measurement and the first vector is the time in seconds and the others are coords at that time.
I want to import these files to timetables to analyze them using the Signal Analyzer. This means that I can't use a struct since the Signal Analyzer only accepts timetables.
I know you are not supposed to do this but I want an easy way to import text files with different names to timetables with those same names.
I have easily imported them all to a structure but it doesn't help me when it comes to the analysis.
  3 Kommentare
Karin Kvickström
Karin Kvickström am 7 Sep. 2020
I would like to plot the results against each other in the signal analyzer, which means that they need to have different variable names.
Stephen23
Stephen23 am 7 Sep. 2020
Bearbeitet: Stephen23 am 7 Sep. 2020
"...which means that they need to have different variable names."
No it doesn't. According to the documentation here:
the signalAnalyzer app supports any number of input arrays with this syntax:
signalAnalyzer(sig1,...,sigN)
which you can easily provide via a comma separated list:
C = {sig1,sig2,...,sigN}; % import this data in a loop
signalAnalyzer(C{:})
Learn more:

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Deepak Meena
Deepak Meena am 7 Sep. 2020
Hey Karin,
As per my understanding, you want to convert .txt file into a timetable. First you might need to make sure that .txt file is in correct format to convert into timetable. Input files must contain datetime or duration vector for row times.
Now once you do that, we can convert into timetable in two steps:
  1. First convert .txt file into table
  2. Now we can covert the table into timetable by:
oranges = readtable("oranges.txt"); %%Step 1
oranges = table2timetable(oranges); %% step 2
For more Information you can refer to the following documentation:
  1. readtable
  2. table2timetable
Now you can visualize all the signals together as:
signalAnalyzer(oranges,pear,apples);

Kategorien

Mehr zu Standard File Formats finden Sie in Help Center und File Exchange

Produkte


Version

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by