Using filenames to name timetables

1 次查看(过去 30 天)
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 个评论
Karin Kvickström
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 2020-9-7
编辑:Stephen23 2020-9-7
"...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:

请先登录,再进行评论。

回答(1 个)

Deepak Meena
Deepak Meena 2020-9-7
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);

类别

Help CenterFile Exchange 中查找有关 Tables 的更多信息

产品


版本

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by