How can I re-save variable with only certain index values?

3 次查看(过去 30 天)
I have a variable, mutualInfoTotal, and I would like to re-save as another variable HD_mutualInfoTotal that only contains the values of mutualInfoTotal that correspond to the following index numbers in mutualInfoTotal: [1:4, 6, 8:10, 12, 15:18, 20:22]. How can I do this?

采纳的回答

Cam Salzberger
Cam Salzberger 2020-6-5
编辑:Cam Salzberger 2020-6-5
HD_mutualInfoTotal = mutualInfoTotal([1:4, 6, 8:10, 12, 15:18, 20:22]);
There are a lot of ways to do indexing in MATLAB, and this is one of the most common. If you came up with those index values by using find, consider using logical indexing instead.
-Cam

更多回答(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