Situation is, that I have MATLAB connected to an Arduino. The Arduino is sending with perhaps 500 Hz data to MATLAB. Different data, so for example temperature, position, current etc. ...
This data is a String and begins with an identifier, that MATLAB is able to know, which message is for which variable in MATLAB. Now, the task is to store this variables in a vector. Problem is, that I can’t know how long this vector will be. So please renounce to explain, how to create a vector with 1000 entries and then a new one ....
I know the function animatedline(), this function can plot sensor data and store this data in a vector. In fact, I need exact this, but without plotting. Why?
The main task of the program is to receive the messages from the Arduino, store them and calculate a response, e.g. to switch on a fan, if the temperature goes to high and send this response message back to the µC (Of course, you will not need for this example MATLAB. It was just an example.)
The second task is, that MATLAB plot also the data, e.g. the temperature that was measured. But MATLAB is much to slow, for do this in one in instance. MATLAB needs a lot time to plot something. Idea is, that I use two instances. One for receiving, storing and responding on the messages and the second one to plot the received messages.
Means, that it could be necessary to store the data in an external file, that the second instance is able to read the data the first received. But this task may not need too much time, that slow down the performance of the first instance, because the idea for using a second instance is, that the first instance is very quick and can response in real time to 500 Hz messages.
Have somebody an idea to:
1) Store the data from the serial port in:
1.1) a vector or table
1.2) in an external file, without losing a lot time
2) Other way to hand over the data from one instance to an other