필터 지우기
필터 지우기

store data in matrix

조회 수: 1 (최근 30일)
paul kaam
paul kaam 2015년 7월 8일
답변: Thorsten 2015년 7월 8일
Hi everyone,
i am getting data every second that looks like this:
a =
Columns 1 through 8
223.5700 -0.0300 -0.0700 50.7000 1.0310 -0.1600 -0.1900 76.1000
Column 9
1.0420
this will go on for approximately 6 -7 hours. Now i want to store this in a matrix (so it grows), so after 3 second I have a matrix of 3 x 9. Unfortunately I am having difficulty realizing it.
could you help me out?
Many thanks
Paul
  댓글 수: 1
Azzi Abdelmalek
Azzi Abdelmalek 2015년 7월 8일
편집: Azzi Abdelmalek 2015년 7월 8일
How are you getting these data? how are they captured? are you using a Daq or just a code?

댓글을 달려면 로그인하십시오.

답변 (1개)

Thorsten
Thorsten 2015년 7월 8일
Growing matrices slow down your program, so preallocate M:
Nhours = 7;
M = ones(Nhours*3600, 9);
Have a look at it's size
whos M
Name Size Bytes Class Attributes
M 25200x9 1814400 double
1.8 MB, seems ok.
Now create an index for the row and increment i every second when you add a new value to M
i = 1;
% start you loop to get data
M(i,:) = currrentdata;
i = i + 1;

카테고리

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by