Hello, I need a help , In Matlab how can I plot a graph from an excel data in real time ?
3 次查看(过去 30 天)
显示 更早的评论
data = xlsread('data.xls');
column_data = data(:, 1); % replace 1 with the column number you want to plot
figure;
ax = axes;
plot(ax, column_data);
xlim(ax, [0, length(column_data)]);
xlabel(ax, 'Time');
ylabel(ax, 'Data');
while true
% Read the latest data from the Excel file
data = xlsread('data.xls');
% Extract the latest data that you want to plot
new_data = data(:, 1); % replace1 with the column number you want to plot
% Append the new data to the existing data
column_data = [column_data; new_data];
% Update the plot with the new data
plot(ax, column_data);
% Pause for a short amount of time to allow new data to be generated
pause(0.01);
end
0 个评论
回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!