필터 지우기
필터 지우기

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

조회 수: 3 (최근 30일)
Marc Pallarés Quinn
Marc Pallarés Quinn 2022년 6월 14일
답변: Karan Singh 2023년 10월 4일
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.

답변 (1개)

Karan Singh
Karan Singh 2023년 10월 4일
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

카테고리

Help CenterFile Exchange에서 String에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by