Using filenames to name timetables

1 view (last 30 days)
Karin Kvickström
Karin Kvickström on 4 Sep 2020
Answered: Deepak Meena on 7 Sep 2020
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.
Stephen23 on 7 Sep 2020
Edited: Stephen23 on 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:
which you can easily provide via a comma separated list:
C = {sig1,sig2,...,sigN}; % import this data in a loop
Learn more:

Sign in to comment.

Answers (1)

Deepak Meena
Deepak Meena on 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:


Find more on Data Type Conversion in Help Center and File Exchange




Community Treasure Hunt

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

Start Hunting!