-
-
Save GiovanniBalestrieri/a87b41060869e58d6f9d to your computer and use it in GitHub Desktop.
Matlab Snippet - Saving CSV data from Matlab to Arduino
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%% Ask desired Sample Rate in Hz | |
rate=input('Enter the sampleRate in Hz. Max 500Hz. Non sgravare... '); | |
delay = 1/rate; | |
str = sprintf('SampleRate fixed to: %f.', delay); | |
disp(str); | |
%% Initializinig rolling plot | |
buf_len = rate; | |
index = 1:buf_len; | |
% create variables for the Xaxis | |
gxdata = zeros(buf_len,1); | |
gydata = zeros(buf_len,1); | |
gzdata = zeros(buf_len,1); | |
if recording | |
resp = input('Press r to record 2 seconds of data','s'); | |
if (strcmp(resp,'r')) | |
disp('Record!'); | |
record = true; | |
numberOfSamples = 0; | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment