%% AUTHOR: OLUWASEGUN SOMEFUN: <oasomefun@futa.edu.ng> (c.) 2020

% Please, Retain this Copyright Information in any Customization, Modification or

% Redistribution

%% Customize as it fits your purpose

% Live Serial DAQ Plotting script for Arduino-Matlab Interfacing

% It can be used for any order DAQ board that is not Arduino.

% Just make sure what is sent to the Serial is comma separated.

%% VERSION 1.0 -> 01.26.2020.

%

% Visualizes real-time logged data from Arduino® in MATLAB®.

%

% Collect communicated data from serial to a "streamData" object.

% Plots the contents of "streamData" in real-time, and

% Stores "streamData" to the MATLAB workspace for later preprocessing and analysis

%% MOTIVATION:

%

% DAQ: Frustration with Available Scripts and Tools for Arduino-Matlab

% I wanted it to be simple, and to a large extent generalistic to the

% amount of logged data size.

% And also readable for customization.

% I wanted to do:

% Input-Output Identification of the dynamics of a physical process model;

% Real time logging and visualization of controller performance.

%% HELP

% 1. Make sure your Serial Output from Arduino is in a comma separated format

% for a certain number of N data variables you want to log.

% Serial.print( (String) var_1 + "," + var_2 + "," + ... + "," + var_N);

% 2. Also Make Sure there is only one Serial command like this in the

% running *.ino or *. cpp program

%

% You might need to change the plotting configuration to change your

% preferred style

% This, although, should work well for most.

%

% Customizable Lines or Sections are started

% with a comment in the form: % * .....

% e.g:-> % * sampling time (from running microcontroller program)

% 3. (OPTIONAL) Make sure, for safekeeping,

% to rename the "streamData" object in the

% workspace after each run