Using filenames to name timetables

1 回表示 (過去 30 日間)
Karin Kvickström
Karin Kvickström 2020 年 9 月 4 日
回答済み: Deepak Meena 2020 年 9 月 7 日
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
Karin Kvickström 2020 年 9 月 7 日
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 Center および File ExchangeTables についてさらに検索

製品


リリース

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by