Clear Filters
Clear Filters

extract certain lines in matrice

3 views (last 30 days)
Dija
Dija on 6 May 2015
Commented: Dija on 6 May 2015
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

Accepted Answer

Guillaume
Guillaume on 6 May 2015
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

More Answers (0)

Community Treasure Hunt

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

Start Hunting!