Stract error line 91 and not recognizing the variable

1 回表示 (過去 30 日間)
Ali Agha
Ali Agha 2022 年 1 月 14 日
コメント済み: Voss 2022 年 1 月 14 日
I have the script below to get the figures of the amplitudes but I got many errors as mentioned in the title when importing the data from text file:
close all;clear;clc;
% Data_Chan1.txt --- x-dirention displacement signal
% Data_Chan2.txt --- y-dirention displacement signal
% Data_Chan3.txt --- y-acceleration signal
% Data_Chan4.txt --- z-acceleration signal
% modify the path to the file to be analysed
path = 'rub-impact/group1/900rpm/Throughput/Data_Chan1.txt');
time=DataChan1(:,1); % time sequency
x=DataChan1(:,2); % displacement signal sequency (x, y, or keyphasor, here is x)
fs=10240; % samling freuency
% plot time waveform
figure
plot(t,x)
% plot spectrum
figure
plotfft(x,fs,'b')
% modify the path to the file to be analysed
path_2=load('rub-impact/group1/900rpm/Throughput/Data_Chan2.txt');
data=path(2:end,1:2);
t=data(:,1); % time sequency
y=data(:,2); % displacement signal sequency (x, y, or keyphasor, here is y)
% plot time waveform
figure
plot(t,y)
% plot spectrum
figure
plotfft(y,fs,'b')
% modify the path to the file to be analysed
path_3=load('rub-impact/group1/900rpm/Throughput/Data_Chan3.txt');
data=path_3(2:end,1:2);
t=data(:,1); % time sequency
y=data(:,2); % displacement signal sequency (x, y, or keyphasor, here is y)
% plot time waveform
figure
plot(t,y)
% plot spectrum
figure
plotfft(y,fs,'b')
% modify the path to the file to be analysed
path_4=load('rub-impact/group1/900rpm/Throughput/Data_Chan4.txt');
data=path_4(2:end,1:2);
t=data(:,1); % time sequency
z=data(:,2); % displacement signal sequency (x, y, z or keyphasor, here is z)
% plot time waveform
figure
plot(t,z)
% plot spectrum
figure
plotfft(z,fs,'b')
% plot keyphasor signal
path=load('rub-impact/group1/900rpm/Throughput/Data_Chan1.txt');
keyphasor=path(:,2); % displacement signal sequency (x, y, or keyphasor, here is keyphasor)
figure
plot(t,keyphasor)
% plot the orbit
path=load('rub-impact/group1/900rpm/Throughput/Data_Chan2.txt');
y=data(:,2); % displacement signal sequency (x, y, or keyphasor, here is y)
figure
plot(x,y)
in the script input1 used the codes below:
DataChan12 = importDataChanfile('Data_Chan12.txt');
size(DataChan12)
data=DataChan12(2:end,1:2);
size(data)
Thanks

採用された回答

Voss
Voss 2022 年 1 月 14 日
Is something like this what you're trying to do?
DataChan1 = importDataChanfile('Data_Chan1.txt');
t=DataChan1{:,1}; % time sequency
x=DataChan1{:,2}; % displacement signal sequency (x, y, or keyphasor, here is x)
fs=10240; % samling freuency
% plot time waveform
figure
plot(t,x)
% plot spectrum
figure
plotfft(x,fs,'b')
% modify the path to the file to be analysed
data = importDataChanfile('Data_Chan2.txt');
t=data{:,1}; % time sequency
y=data{:,2}; % displacement signal sequency (x, y, or keyphasor, here is y)
% plot time waveform
figure
plot(t,y)
% plot spectrum
figure
plotfft(y,fs,'b')
% modify the path to the file to be analysed
data = importDataChanfile('Data_Chan3.txt');
t=data{:,1}; % time sequency
y=data{:,2}; % displacement signal sequency (x, y, or keyphasor, here is y)
% plot time waveform
figure
plot(t,y)
% plot spectrum
figure
plotfft(y,fs,'b');
% modify the path to the file to be analysed
data = importDataChanfile('Data_Chan4.txt');
t=data{:,1}; % time sequency
z=data{:,2}; % displacement signal sequency (x, y, z or keyphasor, here is z)
% plot time waveform
figure
plot(t,z)
% plot spectrum
figure
plotfft(z,fs,'b')
% % plot keyphasor signal
% path=load('rub-impact/group1/900rpm/Throughput/Data_Chan1.txt');
% keyphasor=path(:,2); % displacement signal sequency (x, y, or keyphasor, here is keyphasor)
% figure
% plot(t,keyphasor)
% % plot the orbit
% path=load('rub-impact/group1/900rpm/Throughput/Data_Chan2.txt');
% y=data(:,2); % displacement signal sequency (x, y, or keyphasor, here is y)
% figure
% plot(x,y)
  1 件のコメント
Ali Agha
Ali Agha 2022 年 1 月 14 日
Exactly Benjamin, thank you so much for this great support. I will try it to run the below also
% % plot keyphasor signal
% path=load('rub-impact/group1/900rpm/Throughput/Data_Chan1.txt');
% keyphasor=path(:,2); % displacement signal sequency (x, y, or keyphasor, here is keyphasor)
% figure
% plot(t,keyphasor)
% % plot the orbit
% path=load('rub-impact/group1/900rpm/Throughput/Data_Chan2.txt');
% y=data(:,2); % displacement signal sequency (x, y, or keyphasor, here is y)
% figure
% plot(x,y)
the main issue was about the import the files

サインインしてコメントする。

その他の回答 (1 件)

Ali Agha
Ali Agha 2022 年 1 月 14 日
All done. Thank you so much!
  1 件のコメント
Voss
Voss 2022 年 1 月 14 日
Excellent! You're welcome

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeAnnotations についてさらに検索

製品


リリース

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by