How to save streaming data to Matlab workspace
조회 수: 2 (최근 30일)
이전 댓글 표시
Hi,
I am trying to save real-time streaming data obtained from hardware to Matlab workspace, I use the following command: My issue is, it only saved the last set of data, but not all data.
To save all variables from the workspace in binary MAT-file, test.mat, type
save test.mat
When I tried with this
save('test.mat','-append'); ,
it makes my program halt, so I would like to know what is the correct way to achieve this?
Thank you.
댓글 수: 2
Renato Agurto
2015년 12월 18일
Hi. Do you get an error message? Do the saved variables have the same name? maybe they are constantly overwritten
답변 (1개)
Renato Agurto
2015년 12월 18일
편집: Renato Agurto
2015년 12월 18일
Hi, I don't have experience in real-time streaming but I would try to have a counter (t = 1:100) and save the variable(s) in a cell. For example your variables are var1, var2,... var5 and they are overwritten every second.
Here will all data be stored in a big cell myVar
myVar{t} = {var1, var2, var3, var4, var5};
or append every new variable. Here you get 5 "big" variables: v1,v2,v3,v4 & v5
%initialize
v1 = [];
v2 = [];
v3 = [];
v4 = [];
v5 = [];
And at every second append the data:
v1 = [v1, var1];
v2 = [v2, var2];
...
댓글 수: 2
참고 항목
카테고리
Help Center 및 File Exchange에서 Workspace Variables and MAT-Files에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!