Borrar filtros
Borrar filtros

How can I save the waveform read from the oscilloscope for future reference?

8 visualizaciones (últimos 30 días)
I successfully managed to read the oscilloscope data via 'readwaveform' instrument function. I saved the session, and closed it. After this I opened the saved session file, but could not plot variables, hence could not get waveform of the oscilloscope back.
I tried 'storewaveform' but in there I could not define the location in the syntax.

Respuestas (1)

Pramil
Pramil el 22 de Feb. de 2024
Hey, when you use readWaveform, the data is loaded into MATLAB's workspace as variables. However, once you close MATLAB or clear your workspace, that data is lost unless you have saved it to a file.
To retain the waveform data for later use, you need to save the variables to a file. You can use MATLAB's built-in functions such as save to save the variables to a mat file, which can be loaded back into MATLAB at any time.
You can check the “save” function in detail on this page:
Here is a MATLAB code example that you can refer:
% Assuming you have read the waveform data into variables 't' for time and 'v' for voltage
t = ...;
v = ...;
% Save the variables 't' and 'v' to a .mat file
save('myWaveformData.mat', 't', 'v');
% Now you can close MATLAB or clear the workspace
% Later, to load the waveform data back into MATLAB, use the 'load' function
load('myWaveformData.mat');
% Now 't' and 'v' are back in the workspace and you can plot them
plot(t, v);
xlabel('Time (s)');
ylabel('Voltage (V)');
title('Oscilloscope Waveform');

Community Treasure Hunt

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

Start Hunting!

Translated by