How do you I get my program to label the axes using the column headings in my excel file?
5 次查看(过去 30 天)
显示 更早的评论
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'))
0 个评论
采纳的回答
Image Analyst
2014-11-2
[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.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Data Import from MATLAB 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!