Created
November 11, 2019 00:35
-
-
Save AlexFWulff/e592cb28ec0290647c22f3a947b036e9 to your computer and use it in GitHub Desktop.
This file contains 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
if ~exist('port','var') | |
ports = serialportlist; | |
port = serialport(ports(end),115200); | |
end | |
configureTerminator(port,"CR"); | |
x = input('Sample Name to Write: \n','s'); | |
count = 1; sample_len = 500; plotWinSize = 100; | |
data = NaN(1,sample_len); plot(data) | |
port.flush; | |
while count <= sample_len | |
data(count) = port.readline; | |
count = count + 1; | |
plot(data) | |
xlim([max(0,count-plotWinSize) max(plotWinSize,count)]) | |
end | |
fid = fopen(x, 'wt'); | |
fprintf(fid, '%d\n',data); | |
fclose(fid); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment