Stract error line 91 and not recognizing the variable

1 次查看(过去 30 天)
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!

类别

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

产品


版本

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by