I am a Japanese university student using moku go.
I want to get data from Matlab to moku go oscilloscope and save to csv file.
I found out that I need mokuucli to get the data to csv file.
But matlab does not recognize mokucli.
(I have already downloaded the mokucli software from the utilities.)
Here is the program I created
Please let me know where is the problem.
In addition, please let me know if there is another good way to save the data from matlab to a csv file.
mokucli stream (ip-address=202.13.174.197 stream-id=logsink0 target=stream_data.csv)
i.set_defaults();
catch ME
% End the current connection session with your Moku
i.relinquish_ownership();
rethrow(ME)
end
I have two options written out for saving the data from MATLAB to a csv file:
i = MokuOscilloscope('xxx.xxx.xxx.xxx');
try
i.set_frontend(1, '1MOhm', 'DC', '10Vpp');
i.set_trigger('type', "Pulse",'source', "Input2",'level',2,'mode', "Auto");
i.set_timebase('t1',-1e-6, 't2', 1e-6, 'frame_length', 1024);
i.set_source(1,'Input1');
i.set_source(2,'Input2');
%% Option 1
% Get the data from the oscilloscope into a struct, this method allows
% you to tailor the frame length of the data
data = i.get_data('wait_reacquire',true);
% Reformat the data from a struct to a table
T = table(data.time.', data.ch1.', data.ch2.', 'VariableNames', {'time','ch1','ch2'});
% Save the table as a csv
writetable(T,'./Option1.csv');
%% Option 2
response = i.save_high_res_buffer();
i.download_file('persist', response.file_name, './Option2.li');
% Use the matlab feature '!' to run mokucli as an Operating system command
! mokucli convert Option2.li --format=csv
catch ME
% End the current connection session with your Moku
i.relinquish_ownership();
rethrow(ME)
end
i.relinquish_ownership()
Please let me know if you have any trouble with this