How to match an excel cell with a data file to create a plot

조회 수: 3 (최근 30일)
Sofija Radulovic
Sofija Radulovic 2020년 6월 14일
for i=1:1:50
%randomizing the value of a between 1 to 7092
a=randi([1,7092]);
%making the name of the R random
name=['R',num2str(a),'.txt'];
%importing that randomized R text file
data=importdata(name);
%making the matrix into a vector
acceleration=data(:);
acceleration(i);
%reading excel file
excelfile = xlsread('Final_NGA_Flatfile.xlsx');
%extracting dt from excel files
dt=excelfile(:,4);
%putting ft matrix into one vector
dtnewnew=dt(:);
for n=1:size(dt)
xvalues=dt;
xvaluesnew=xvalues(:);
xvaluesnewnew=xvaluesnew*(n-1);
end
%PLOT/LABEL
plot(xvaluesnewnew,'DisplayName','xvaluesnewnew');
hold on;
plot(acceleration,'DisplayName','acceleration');
hold off;
xlabel('time');
ylabel('acceleration');
title('Earthquake Data (acceleration vs. time)');
end
I am trying to match an excel cell with data from a text file to create a plot. I want to do this with 50 excel cells, so i think i should use a loop, but i am not sure. I cannot upload the excel file and data files because there are 7000 data files.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Spreadsheets에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by