Mathematica 9 is now available
Student Support Forum
-----
Student Support Forum: 'Lists manipulation' topicStudent Support Forum > General > Archives > "Lists manipulation"

Next Comment >Help | Reply To Topic
Author Comment/Response
tlatev
04/18/12 7:12pm

I need some help with mathematica functional programming.

I have 3 lists:
knownPoints = {{101, 3128.52, 2897.91}, {102, 3971.37, 2783.48}, {103,
2945.81, 2000.72}, {104, 3760.85, 1660.53}};
unknownPoints = {{1, 3183.60, 2435.50}, {2, 3724.60,
2129.00}};
measurements = {{1, 101, 465.75}, {1, 102, 861.22}, {1, 103,
495.62}, {1, 2, 621.67}, {2, 101, 973.10}, {2, 102, 699.49}, {2,
103, 789.42}, {2, 104, 469.78}};

The format is obvious:
PtNo,Easting,Norting for Points and
PtNo,PtNo,Distance for measurements

I need to restructure measurements, so that all the information in the 3 lists is merged into one
The routine would need to substitute all occurrences of PtNo in measurements with the complete list {PtNo,Easting,Northing}

So measurements[[1]] for example would look like this:
{{1, 3183.60, 2435.50}, {101, 3128.52, 2897.91}, 465.75}

One thing I need to watch out for is not to touch the distances in measurements as it may so happen that the distance is say 101 meters and a point with the same number exists

I'm sure this can be accomplished in MMA but I cannot figure out how to do it without using IFs, DOs, WHILEs, FORs etc.

URL: ,

Subject (listing for 'Lists manipulation')
Author Date Posted
Lists manipulation tlatev 04/18/12 7:12pm
Re: Lists manipulation Bill Simpson 04/19/12 1:33pm
Re: Re: Lists manipulation Bill Simpson 04/19/12 5:28pm
Re: Re: Re: Lists manipulation tlatev 04/19/12 11:01pm
Re: Lists manipulation tlatev 04/19/12 3:11pm
Re: Re: Lists manipulation Bill Simpson 04/19/12 8:19pm
Next Comment >Help | Reply To Topic