import ods or xls to matlab and refresh data

5 次查看(过去 30 天)
Hi
How can I import data from and ods or xls to matlab and refresh data every 3 seconds?

回答(1 个)

Akshat
Akshat 2024-11-24,18:15
You can run an infinite loop which pauses every three seconds and reads the data from an XLS file.
You can modify the following code to suit your use case the best:
fileName = 'data.xlsx'; % or 'data.ods'
sheetName = 'Sheet1';
while true
try
data = readtable(fileName, 'Sheet', sheetName);
disp(data);
catch ME
disp(['Error reading file: ', ME.message]);
end
pause(3);
end
Feel free to ask any follow-ups, hope this helps!

类别

Help CenterFile Exchange 中查找有关 Programming 的更多信息

标签

产品


版本

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by