How to replace a column in a text file with time and plot a graph from it?
1 回表示 (過去 30 日間)
古いコメントを表示
The first column shows the frequency of data aquisition, which is 1000 hz. But I need to replace the first column of the text file with time, starting with 0 secs, then 0.0001s till 60s. it is then used to plot a graph of data points, where the 2nd and 3rd columns are outputs. The picture of text file is attached.
Any help is appreciated.
I tried with the following command but it didnt work and took forever.
data = load('test1.txt');
data(:, 1) = 0:0.0001:60000;
0 件のコメント
採用された回答
KALYAN ACHARJYA
2020 年 3 月 4 日
編集済み: KALYAN ACHARJYA
2020 年 3 月 4 日
Please note: It should be column vector
data = load('test1.txt');
data(:, 1) =[0:0.0001:60000]';
5 件のコメント
KALYAN ACHARJYA
2020 年 3 月 4 日
Its simple
>> length(data(:,1))
ans =
62000
>> length(0:0.0001:60000)
ans =
600000001
Make the array 0:0.0001:60000 having the same length as length(data(:,1)), which is 62000, or use
linspace(0,60000,62000); % set the step size as requred
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Text Data Preparation についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!