Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: Storing of values in an array
Replies: 7   Last Post: Jan 30, 2014 8:44 AM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Narayanan

Posts: 14
Registered: 6/10/13
Re: Storing of values in an array
Posted: Jan 30, 2014 8:44 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

I have a matrix.
linedata=[ 1 2 0.0922 ;
2 3 0.4930 ;
3 4 0.3661 ;
4 5 0.3811 ;
5 6 0.8190;
6 7 0.1872 ;
7 8 0.7115 ;
8 9 1.0299 ;
9 10 1.0440 ;
10 11 0.1967 ;
11 12 0.3744 ;
12 13 1.4680 ;
13 14 0.5416 ;
14 15 0.5909 ;
15 16 0.7462 ;
16 17 1.2889 ;
17 18 0.7320 ;
2 19 0.1640 ;
19 20 1.5042 ;
20 21 0.4095 ;
21 22 0.7089 ;
3 23 0.4512 ;
23 24 0.8980 ;
24 25 0.8959 ;
6 26 0.2031 ;
26 27 0.2842 ;
27 28 1.0589 ;
28 29 0.8043 ;
29 30 0.5074 ;
30 31 0.9745 ;
31 32 0.3105 ;
32 33 0.3411 ;]

Out of this, the first column is begin point, and the second column is the destination point. The third column is the distance between the 2 points. I want to find the distance between 1 and all the points. So for the distance between 1 and 4, it should add the value of distance between 1 and 2, 2 and 3, 3 and 4.

Suppose I want to find the distance between 5 and 20. It should add the value of distance between 5 and 4, 4 and 3, 3 and 2, 2 and 19, 19 and 20.
Same way if I want to find the distance between 18 and 28, it should add the value of distances between those 2 points alone.

This way I want to find the distance from all the points to all the points.(i.e) from point 1 to all the points, from point 2 to all the points and so forth. How can I do it? Kindly help me in this regard.

Regards



Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.