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 个)

类别

Help CenterFile Exchange 中查找有关 2-D and 3-D Plots 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by