extract certain lines in matrice

3 次查看(过去 30 天)
hi everyone i have this matrice
0.8979 0.8979 0.8979 0.8979 0.8979 0.8979 0.8979 0.8979
0.5934 -0.5934 0.5934 -0.5934 0.5934 -0.5934 0.5934 -0.5934
0.5934 0.5934 -0.5934 -0.5934 0.5934 0.5934 -0.5934 -0.5934
0.8979 -0.8979 -0.8979 0.8979 0.8979 -0.8979 -0.8979 0.8979
0.5934 0.5934 0.5934 0.5934 -0.5934 -0.5934 -0.5934 -0.5934
0.8979 -0.8979 0.8979 -0.8979 -0.8979 0.8979 -0.8979 0.8979
0.8979 0.8979 -0.8979 -0.8979 -0.8979 -0.8979 0.8979 0.8979
0.5934 -0.5934 -0.5934 0.5934 -0.5934 0.5934 0.5934 -0.5934
I want to extract the line 1&2&4&7 in order to put them in another equation can anyone give me the code to put certain lines in another place

采纳的回答

Guillaume
Guillaume 2015-5-6
This is very basic matrix indexing which is covered in the Getting started tutorial:
m = [0.8979 0.8979 0.8979 0.8979 0.8979 0.8979 0.8979 0.8979
0.5934 -0.5934 0.5934 -0.5934 0.5934 -0.5934 0.5934 -0.5934
0.5934 0.5934 -0.5934 -0.5934 0.5934 0.5934 -0.5934 -0.5934
0.8979 -0.8979 -0.8979 0.8979 0.8979 -0.8979 -0.8979 0.8979
0.5934 0.5934 0.5934 0.5934 -0.5934 -0.5934 -0.5934 -0.5934
0.8979 -0.8979 0.8979 -0.8979 -0.8979 0.8979 -0.8979 0.8979
0.8979 0.8979 -0.8979 -0.8979 -0.8979 -0.8979 0.8979 0.8979
0.5934 -0.5934 -0.5934 0.5934 -0.5934 0.5934 0.5934 -0.5934];
subm = m([1 2 4 7], :); %select all columns of rows 1, 2, 4 and 7

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Matrix Indexing 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by