导出matlab数据mat中某个向量组,从Matlab导出多个向量到文件(Exporting multiple vectors to file from Mat

论坛 期权论坛 编程之家     
选择匿名的用户   2021-5-21 13:04   48   0

Every vector should represent a row. Vector elements ->columns, Vectors -> rows.

I'm not sure what you mean by that without any further context. Anyway, saving variables for later use is easy enough. Here's a little demo:

>> x = 1:5

x =

1 2 3 4 5

>> y = 5:-1:1

y =

5 4 3 2 1

>> whos

Name Size Bytes Class Attributes

x 1x5 40 double

y 1x5 40 double

>> save('myvars')

>> clear

>> whos

>> x

Undefined function or variable 'x'.

>> y

Undefined function or variable 'y'.

>> load('myvars')

>> whos

Name Size Bytes Class Attributes

x 1x5 40 double

y 1x5 40 double

>> x

x =

1 2 3 4 5

>> y

y =

5 4 3 2 1

This will create a file myvars.mat which holds the values of all currently defined variables.

EDIT in response to your comment:

So let's say we have these N vectors V1,V2,...VN, you can create the desired matrix by issueing

M = [V1;V2;...;VN]

Now save it to a file with

save('mymatrix', 'M')

This will create a file mymatrix.mat which holds the matrix M for later use. To load it into the workspace, simply issue

load('mymatrix')

分享到 :
0 人收藏
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

积分:3875789
帖子:775174
精华:0
期权论坛 期权论坛
发布
内容

下载期权论坛手机APP