Save many vectors in one file

조회 수: 19 (최근 30일)
upt0zer0
upt0zer0 2012년 12월 6일
Hi
I want to do the following:
(1) I get a lot of vectors, size [80,1] (2) This vectors should saved in a file or a workspace variable (3) but it shouldn't save [80,1],[80,1],[80,1],... it should save all as one big vektor with all elements in a row...
how can i do this?
Thx for any help.
  댓글 수: 1
upt0zer0
upt0zer0 2012년 12월 6일
ok, i know what you mean. the problem is, that I want to use it in an Simulink S-Function. So with every step there is a vector with dimensions [80,1]. When the first vector come, it should saved in a variable oder file. Then next step the next vector should be written in the same variable or file. But not vector after vector ... i want it as one big vector.
alternative, this would be even better: block or function to buffer 10 vectors of size [80,1] to one vector of size {800,1]

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

답변 (2개)

Thomas
Thomas 2012년 12월 6일
편집: Thomas 2012년 12월 6일
a=rand(10,1); % first vector
b=rand(10,1); % second vector
c=rand(10,1); % third vector
out=[a b c] % combined matrix of above vectors
savename='test.mat';
save(savename,'out') % save the combined vector out in test.mat

Jan
Jan 2012년 12월 6일
"I get a lot of vectors" does not reveal, how these vectors are stored. If you store them in the columns of a [80 x n] matrix, the question is solved already. If you store them in a {1 x n} cell, simply run:
M = cat(1, C{:});
If you store them in another format, please explain this, because we cannot guess such details.

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by