如何专门在数据矩阵中选择列?

4,073 views (last 30 days)
jj
jj on 12 Nov 2011
Commented: Fercho_Salaon 15 Apr 2021
Hello guys,
I know this is a really simple question, which I can't seem to find any answers around on the internet or the help stuffs I've on Matlab.
我上传了一个带有100个数据系列的数据集。但是,我正在尝试只选择特定的列,例如列77到83和第86栏。我如何在Matlab中做到这一点?通常,这将是:
xdatatemp =xdata(:,77:86) - to select columns 77 to 86. But, how do I specifically select col 77 to 83, and col 86?
非常感谢。
J

Accepted Answer

Sven
Sven on 12 Nov 2011
尝试:
xdatatemp = xdata (: [77:83 86])
And you can even use "end" keywords such as:
xdatatemp = xdata(:,[77:83 86 end end:-1:end-5])
也就是说,当然,如果您希望列77到83,那么86,那么最后一列,那么最后5列向后计数;)
6 Comments
Fercho_Sala
Fercho_Sala on 15 Apr 2021
@Rik ok, understood... I'm sorry ;)

Sign in to comment.

更多的Answers (2)

珊瑚德马尔瓦尔·罗德里格兹
编辑:珊瑚德马尔瓦尔·罗德里格兹 on 14 May 2020
我有一个各种行和三列的矩阵。一些数据集具有相同的数字。我想把它们放在一起为了改造它。如何按值分隔矩阵?例如,#1等的所有值都是正确的?
1961 1 -11.4
1961 2 -12.3.
1961 3 -8.2
1961 4 -8.6
1961 5 -2.4
1961年6 7.4
1961 7 14.8
1961 8 11.1
1961 9 5.9
1961 10 3.7
1961 11 -6.3
1961 12 -13.3
1962 1 -12.7
1962 2 -8.1
1962 3 -13
1962 4 -1.1
1962年5 2.8
1962 6 5.9
1962 7 12.2
1962 8 8.9
1962 9 7.2
1962 10 -0.1
1962 11 -1
1962 12 -11
1 Comment
Rik
Rik on 20 Aug 2020
Comment posted as flag by Abdul BasithAshraf:
查找组函数。你通过询问不同的问题来回答。请在将来避免这一点。

Sign in to comment.


prakash patel
prakash patel on 18 May 2020
编辑:prakash patel on 18 May 2020
a=[12345; 23456; 34567; 45678]
i (a)(2.5)
ii colom matrix v=a(;,4)
iii matrx a
iv a(:,2:3)
V SA = A(2:3,2:4)

Community Treasure Hunt

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

开始狩猎!