How to select specific matrix rows trough specifik given numbers
Afficher commentaires plus anciens
Hey guys. Im working on a project where i have i to pick out specific rows in one N x 6 matrix matching a specifik given value.
Then using the placement of those specific rows in order to calculate data within those specific rows in a different N x 4 matrix.
The rows within the N x 6 matrix is combined like: [ year , month , day , hour , minute , second ]
So for an example i need to find all rows with the hour 15, i find two rows in that specific dataset one in row 4 and one in 10. I then need to calculate the exact same rows within the N x 4 matrix.
Any ideas to how this is done?
i've tried out with A(: , 4==15) but that doesn't tell the sepcific rownumber.
2 commentaires
vimal kumar chawda
le 22 Avr 2020
First mention the number of loop with some i and after that mention at which number of loop the requirement fulfill. And if the loop number is 5 then it should stored the value at position 5th. all other matrix will be 0 and the you will get row number.
Or you can mention with another variable with k so if i all requirement fulfill then stores the x value which is row (x,y). you have to define the iteration perfectly.
Image Analyst
le 22 Avr 2020
vimal - please put down below in the Answer section with the rest of the answers. Thanks in advance.
Réponse acceptée
Plus de réponses (1)
Tommy
le 22 Avr 2020
If A is your N x 6 matrix and B is your N x 4 matrix,
B(A(:,4)==15,:)
Catégories
En savoir plus sur Matrix Indexing dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!