indexing into an array
6 views (last 30 days)
Show older comments
I know this is probably one of the easiest thing to do, but right now, I am stuck at it. I have got 2 Arrays. One is 55618x4 (A) and the other one is 1819x1 (B).
A
1 -20.8047047000000 -9 9
2 -20.8047047000000 -9 -9
3 20.8047047000000 -9 -9
4 20.8047047000000 -9 9
5 -20.8047047000000 9 -9
6 20.8047047000000 9 -9
7 20.8047047000000 9 9
8 -20.8047047000000 9 9
9 41.6427193000000 9 -9
B
514
515
516
517
518
519
520
According to the number in the first column, the information from the three other columns should be written from array A to array B. So I need something like this:
C
514 41.64271 8.5 0
515 40.46843 7.3 5
With
[LIA,LOCB]=ismember(s11(:,1),Coords(:,1));
I can find the rows I need, but how can I fill the array?
2 Comments
Steven Lord
on 20 Sep 2021
It's not at all clear how you got from A and B to C. Why do you take data from the 1st row of B and the 9th row of A (I assume) to generate the 1st row of C? And where did 8.5 and 0 come from? Neither of those numbers appear in either A or B.
Please explain the rules you want to use to create C more thoroughly and clearly.
Accepted Answer
More Answers (0)
See Also
Categories
Find more on Matrices and Arrays in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!