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!

카테고리

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