How do you I get my program to label the axes using the column headings in my excel file?

3 Ansichten (letzte 30 Tage)
I have three column headers in an excel file: A1:A1 is time, B1:B1 is velocity. This is what I have so far but I cant get my plot to label the axes. Please help me out .
clear;
clc;
data = xlsread('veldata.xlsx');
t = data(:,1);
v1 = data(:,2);
v2 = data(:,3);
avg_v1v2 = ((v1 + v2)/2);
plot(t,v1,'b',t,v2,'g',t,avg_v1v2,'r:')
xlabel(xlsread('veldata.xlsx','Sheet1','A1:A1'))

Akzeptierte Antwort

Image Analyst
Image Analyst am 2 Nov. 2014
[data, txt, raw] = xlsread('veldata.xlsx');
% other code...
col1Header = txt{1, 1};
col2Header = txt{1, 2};
xlabel(col1Header, 'FontSize', 25);
ylabel(col2Header, 'FontSize', 25);
Adapt as needed.

Weitere Antworten (0)

Kategorien

Mehr zu Data Import from MATLAB finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by