How to get value in a column or row

3 次查看(过去 30 天)
Hi member, I have a matrix Ex a=[1 2 3 5 6 8], and I only want to take b= a(1), a(2) and a(4) : 1,2,5 in stead of the whole column. Can you instruct me to do it. Thank you.

采纳的回答

KSSV
KSSV 2018-7-30
a=[1 2 3 5 6 8] ;
idx = [1 2 4] ;
b = a(idx) ;

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Data Types 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by