Community Tip - Need to share some code when posting a question or reply? Make sure to use the "Insert code sample" menu option. Learn more! X
Hi there
I want to exclude some values from d when it is bigger than the width .... I want the program to just exclude the values that do not fulfil the condition, I used this program ,but it shows strange error ...I'm sure both of them have the same units
How to fix this ?
Solved! Go to Solution.
Excellent, glad it works. Hopefully, you'll be able to make use of any MP 10 worksheets that are posted.
Stuart
@YA_10963798 wrote:
Do you think if I download Prime 10 my work in prime 9 will be easily transferred? or I would have to start all over again
My guess is that you won't experience any problems if you do, but then on the other hand its always a risk to change the horses in-midst of a race.
We have seen her in the forum that Prime 10 'introduced' some new bugs, some of which were fixed in the current 10.0.1.0, other may still remain. As far as I am aware these bugs mainly concerned the symbolic engine (which you seem not to use anyway) and function with a lot of arguments. The latter is something you don't use anyway as far as I can tell and seems to be one of the bugs already fixed in 10.0.1.0.
But you can give it a try anyway - when you install Prime 10 this does not mean that you lose Prime 9. Both versions can coexist on the same machine. Only the converter (for legacy Mathcad files) would not be able to create Prime 9 files anymore and of course once you save a file in P10 you will never be able to open it in P9 again or convert it back to P9 format!
The undocumented (and unsupported) method mentioned by DJNewman to turn a range into a vector by a simple inline evaluation will not work in P10 anymore. While it was illogical that an evaluation would change the data type, it was a very handy and convenient method and I would had wished that PTC would provide an as convenient built-in alternative (the various Mathcad functions have their drawback, especially when used inside a program).
But as far as I can remember, you did not use this method in your sheet anyway.
Hi Werner @Werner_E
I'm trying to show the results the same way you did , but error occurs . It didn't work once I add "row" , though I used your way and Stuart way ,
this is result3
I need to show the rows of the results and then draw it the same way you draw the this one , but only with the selected values
can you show me how ?
This is now not a question concerning "Exclude some values", isn't it.
It rather a question belonging to the thread about the nearest point.
I was not ware that you also needed the rows number of that nearest point because you did not specify it in your intial posting there. You just said that you need the nearest point and the distance.
Its not difficult to modify the functions to also provide the index of the point.
Here done with the first 'table' (function 'getNearest') I provided in that thread
Ok that was easy... I spent 2 hours thinking how to do that hhh . I even wrote different function.. Thank you
Werner, I'm so sorry to ask so many question...I promise this is my last question in this thread
I'm trying to write a new program to show the selected points ... the word "result 3" is the exclued values... but obviously what I wrote is wrong
I'm trying to write the same program , so then I can plot it as we draw it before ..
I want to show the selected values in different color in this plot
The plot I made out of fun was meanly meant to be used for my demo data with just a couple of points in each vector. It should demonstrate that its possible that two or more points in A have the very same minimal distance from a point in C as the question as to what to do in this case was not (and still isn't) answered. My "table" used just the first of the multiple point which may be possible, "table2" would show all of them which is the reason why the "A point list" in table2 are vectors as there could be more than one nearest point for a specific C-point.
So the reason for the plot was not only to show the points but mainly to connect corresponding points with straight lines.
This did not make much sense with the original data so I zoomed in by adjusting the axis limits manually (Prime unfortunately does not offer a zoom facility).
Without zooming it would look like this. The connections between the corresponding points would not be seen.
I also noticed that with the Excel data you provided there is no single point in C with more than only one nearest A-point. If this is always so for sure or if it suffices to use the first one if there would be more than one point with different input data, I guess that "table" is preferable over "table2" because its not nested and so makes for a nicer display. Of course there may be reasons for rather using a structure as in "table2" or as the one Stuart had provided. Its up to your choice.
Concerning the plot I am not sure what you would like to plot.
I have not looked into detail in the sheet you posted last as it was a bit too confusing for me with all the different suggestions for the nearest points mixed up.
I look at result3 now and its just a vector of 1308 distance values. So what exactly would you plot here? I am not sure what you would like to see in the plot.
Guess you would first decide upon the data format for A and C.CPT you want to use (either still nested or flattened), decide on one of the methods to create the nearest point list and then chose a way to extract whatever points or distances you need.
Maybe cleaning up the worksheet in this respect would help.
Form the picture you posted its not clear to me what your function "new" is supposed to create with its three nested for-loops.
Maybe now we are back to the subject of this thread as i think that you not only want to delete some valued from the min-distance vector but you also would like to keep the corresponding point coordinates as well.
So I modified my "exclude" function to work on matrices. You have to provide the column index of the column you want the boolean function to be applied to.
Given that matrix
and applying this boolean function
to column 6 ("distance"), we get
To get rid of the header we can modify the boolean function
Now you could plot all C-points (green) with a minimum distance to A greater or equal as width (45.3 m).
The reason for this undesired zoom chosen by the plot is that the origin is one of the C.points. I am not sure if this is as it should be.
So to get something more visually appealing we again have to manually change the axis limits
One thing I noticed is that the number of entries in your "result3" and in my "raw" differ significally!
This could mean that my way of calculating the minimum distance in getNearest might be wrong?!?
You'll have to double check. I did not bother follow up to look where the vector d would come from, etc.
Your sheet definitely needs a heavy cleanup, I think.
EDIT: Just noticed that you uses <= in your boolean function while I used <. But this seems to have no effect anyway because there seems to be no min-distance of exactly 45.3 m.
Hi Werner,
Thank you for your reply.
I think the reason I get different numbers in (result3) is because I changed the equation I wanted to spot the selected and you spot the excluded values >> both of them works for me .
for the plot is incredibly impressive and showed we are in the right track.
However, why do you think my plot looks different than yours?
@YA_10963798 wrote:
Hi Werner,
Thank you for your reply.
I think the reason I get different numbers in (result3) is because I changed the equation I wanted to spot the selected and you spot the excluded values >> both of them works for me .
for the plot is incredibly impressive and showed we are in the right track.
However, why do you think my plot looks different than yours?
Ahh! I did not see that the numbers I posted (1308 and 720) would perfectly add up to the total number of C-points (2028)! 🙂
You plot looks different because you forgot to set the Line Style to "none". That way Prime connects the points.
I already mentioned that the origin (0;0) is one of the C-points and it looks for me that this should not be that way. Thats the reason Prime scales the plot so that this point at the lower left is also part of it and therfore the main data is so tiny at the upper right.
I see .. Thank you I corrected that
Hi Werner,
Actually what I need is to show in the plot all the points and then color the ones we selected which there distance is less than 45.3m in different color.
So it is easy for anyone to grab the idea that there is this amount of CPTs are exlculded from the plot rather go to check each single distance.
in the new plot it is okay if we don't show the distance , but I need to show the one selected. So, let's say A points in blue, Exclued C points in red and the rest of point C in green. Is that possible?
Thanks @Werner_E
@YA_10963798 wrote:
Hi Werner,
Actually what I need is to show in the plot all the points and then color the ones we selected which there distance is less than 45.3m in different color.
So it is easy for anyone to grab the idea that there is this amount of CPTs are exlculded from the plot rather go to check each single distance.
in the new plot it is okay if we don't show the distance , but I need to show the one selected. So, let's say A points in blue, Exclued C points in red and the rest of point C in green. Is that possible?
Thanks @Werner_E
Yes, and you actually already did in your plot.
After choosing a Symbol for each plot as you already did you simply have to change the line style to "none" so that only the points are plotted without connecting them.
And then color the second and the fourth plot in blue as these are the A-points corresponding to the plotted C-points.
That way only the 2028 A-points which correspond to one of the C-points are plotted.
If you need to plot all 3146 A-points, you simply delete the second and fourth trace and plot second column of A over first column of A as a third plot.
Your points are quite close to each other so in a plot which shows all of them the points will overlap.
One has to be careful concerning the order the traced are created. The last plot will overlap the others and I found no way to change that order (other than redoing the plot from anew).
As already written above, the data for C.CPT includes the origin (0;0). This is the reason why Prime choses the zoom in a way so that this point is included in the plot, resulting in the main data to be shown very tiny at the upper right.
As i thought that its not as intended that the origin is part of the c points, I investigated and found that the origin is part of the C data not once but even nine times at different rows.
In the attached sheet I got rid of these entries by using the trim command
You used absolute values when you used the submatrix command. As table2 would have a lower number of rows now, this command would fail. I changed it to be aware of the row number of table2.
Now that the origin is not part of the dataset anymore, Prime automatically chooses a more appropriate zoom and we don't have to manually 'zoom' by changing the axis limits
or that way
Prime 9 sheet attached
I just saw your reply. Thank you so much Werner. I wish I can send you a gift ..
Yusra