Hello, I and my teammates already wrote the code which calculates and shows mean squared value using recent 10 data points of EMG in real time. When the button is pushed, EMG data from 8 channels starts to be streamed and gathered and MSV also starts to be calculated and shown in real time.
I'd like to make and save a log for these calculated MSV values from the 8 channels which change over time. I've wrote some codes which allocates the new variable for saving MSV values. I've also tried the code by writing writematrix function to save the data as Excel file, but I failed to save. Are there any tips or advices for it?
This is the part of the code I've wrote.
msvlog = [0,0,0,0,0,0,0,0];
btn = uibutton(fig,'state',...
'Position',[10, 700, 100, 30],...
'ValueChangedFcn', @(btn,event) plotButtonPushed(btn, ax, myo, charac_val, msvlog, parameter));
Unrecognized function or variable 'fig'.
function plotButtonPushed(btn, ax, myo, charac_val, msvlog, parameter)
if numel(emg) ~= 0 && btn.Value == true
ax(j).XLim = [0 length(emg)/200];
msv = msv + y(length(y)-l)^2;
msv = msv + y(length(y)-l)^2;
charac_val(j).Text = num2str(msv);
elseif btn.Value == false
if myo.isStreaming == true
writematrix(msvlog, parameter)