Getting an array with data
1 次查看(过去 30 天)
显示 更早的评论
Hello,
I have a question regarding getting data from an array
I have one array of data. lets say (array 1):
Index Speed # 1 5 # 2 9 # 3 4 # 4 5
(index 1 has value 5 , index 2 has value 9 etc)
I made another array (array= indexdata) which contain the indexnumbers of the values which are interested for me ( lets say i only want to look at index number two which has the value 2).
So how can i program that matlab makes a new array of the values of the first arrays, whose indeces are listed in the second array,
it sounds complicated but what i want is easy :)
0 个评论
采纳的回答
Vishal Rane
2012-12-12
So ,
array1 = [ 5 9 4 5] % original array
array2 = [ 2 4 ] % array of indices
array3 = array1(array2) % elements from array1 as per indices listed in array 2
2 个评论
更多回答(1 个)
Hello kity
2012-12-12
1 个评论
Vishal Rane
2012-12-12
Recommend you to create a separate thread for this question, since this question is already marked as answered.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Matrix Indexing 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!