Effacer les filtres
Effacer les filtres

Hello, I need a help , In Matlab how can I plot a graph from an excel data in real time ?

3 vues (au cours des 30 derniers jours)
OMAR EL MZOURI
OMAR EL MZOURI le 24 Mai 2023
Modifié(e) : KSSV le 24 Mai 2023
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

Réponses (0)

Catégories

En savoir plus sur 2-D and 3-D Plots dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by