Filter löschen
Filter löschen

How can I save live recorded data from force platforms in Matlab?

3 Ansichten (letzte 30 Tage)
Marc Pallarés Quinn
Marc Pallarés Quinn am 14 Jun. 2022
Beantwortet: Karan Singh am 4 Okt. 2023
Hi, I'm having problems trying to save incoming data in Matlab.
The code I'm using is the AMTI Matlab test framework. This code uses an interactive GUI to initialize and start/stop the force platformes and also a live plot of the data that is being recorded.
The collection data part of the code tells you to modify it to your own needs and it gives you the code to record a simple point as following:
%Record a single point of the selected amplifier/plate
DataHandler.Sample=dataArray(DataHandler.AmpOffset+2:DataHandler.AmpOffset+7);
So I would like to know how can i save all the data in a single array.

Antworten (1)

Karan Singh
Karan Singh am 4 Okt. 2023
Hi Marc,
From what I understand, the goal is to save all the incoming data in a single array. For this you can initialize an empty array before starting the data collection loop. Then, within the loop, append each recorded point to the array.
Here's an example of how you can modify the code to achieve this:
% Initialize an empty array to store the recorded data
recordedData = [];
% Start the data collection loop
while (collectData)
% Record a single point of the selected amplifier/plate
singlePoint = dataArray(DataHandler.AmpOffset+2:DataHandler.AmpOffset+7);
% Append the recorded point to the array
recordedData = [recordedData; singlePoint];
% Additional code for processing or plotting the data can be added here
% Check for the stop condition and break the loop if necessary
if (stopCondition)
break;
end
end
% Save the recorded data to a file (optional)
save('recorded_data.mat', 'recordedData');
In this example, the recordedData array is initialized as an empty array before the data collection loop. Inside the loop, each recorded point is stored in the singlePoint variable, and then appended to the recordedData array using the concatenation operation [recordedData; singlePoint]. Finally, you can save the recorded data to a file using the save function if desired.
Attached below are some documentation links that you may find helpful:
Hope this helps!
Karan Singh Khati

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by