フィルターのクリア

How to remodify matrix

2 ビュー (過去 30 日間)
shravani nethi
shravani nethi 2019 年 12 月 21 日
編集済み: Dyuman Joshi 2021 年 1 月 4 日
I have a 6x4 matrix, in which each line has id, x-cor,y-cor, and z-cor for all 3 molecules continuously at time step t1 forllowed by same at t2.
I want to remodify the matrix such that each new file consists only the cord of given molecule
for eg;
1 3.34 4.56 7.86
2 7.09 4.99 5.98
3 8.67 6.90 7.00
1 3.78 2.89 4.78
2 4.78 7.24 6.38
3 4.56 3.10 6.27
I want out put as in file 1as
1 3.34 4.56 7.86
1 3.78 2.89 4.78
and in file 2 as
2 7.09 4.99 5.98
2 4.78 7.24 6.38
and file3 as
3 8.67 6.90 7.00
3 4.56 3.10 6.27

採用された回答

Dyuman Joshi
Dyuman Joshi 2019 年 12 月 21 日
編集済み: Dyuman Joshi 2021 年 1 月 4 日
You can use following commands.
Let the 6x4 matrix be 'xyz'.
file1 = xyz(1,:;4,:)
file2 = xyz(2,:;5,:)
file3 = xyz(3,:;6,:)
  1 件のコメント
Walter Roberson
Walter Roberson 2019 年 12 月 21 日
MATLAB does not use [] for indexing, and that would not be valid syntax if you changed to () instead of []

サインインしてコメントする。

その他の回答 (1 件)

Walter Roberson
Walter Roberson 2019 年 12 月 21 日
If the matrix is definitely 6 x 4, just use indexing as appropriate
dlmwrite('file1.txt', YourMatrix([1 4], :), ' ')
dlmwrite('file2.txt', YourMatrix([2 5], :), ' ')
dlmwrite('file3.txt', YourMatrix([3 6], :), ' ')
  1 件のコメント
shravani nethi
shravani nethi 2020 年 11 月 27 日
Thanks..

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeWavelet Toolbox についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by