Using results from output of function
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Using results from output of function
Vers: MathCAD Prime 7.0.0.0
See screen grab attached.
I'm not that hot on mathcad so excuse the lack of termiknowledge.
Essentially I've created a function which outputs a 'list' of values I then go on to change the input values producing new 'lists'.
I would then like to evaluate the first value of each list against the others, however, I believe the 'lists' need to be any of; an array, a vector or a matrix. Which I'm assuming they're not going by B[1]= failing to return a value.
My attempts to convert them have failed: (units are not compatible)
As you can see at the moment I've just typed out the first value of the 'list'.
Any help is appreciated.
Cheers,
J
Solved! Go to Solution.
- Labels:
-
Mathcad Usage
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Ok so I've found that if I define my original range as equal to a new variable it becomes a vector or array. This then means my output becomes a vector/array I can then pull values from it.
Which if you ask me is stupid all I'm doing is typing z:=x and z is now a vector/array where x wasn't.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
I like your 'termiknowledge' !
But: Please attach your Prime worksheet, not just a picture.
Further: You need to understand the difference between a range and a vector.
You've created z as a range. And while the result of B(z) looks like a vector, it is not, so you cannot index it.
Success!
Luc
For some info on range <> vector see here: https://community.ptc.com/t5/Mathcad/How-to-form-a-matrix-with-variables-defined-with-range/m-p/891020#M207928
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Hi Luc
As shown in my own reply all I needed to do was redefine my z range as any other variable and all was gravy.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Yep, gravy.
But bear in mind that you are now using an undocumented trick. It may become supported functionality, or become non-functional in a future version of Prime.
Success!
Luc
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Ok so I've found that if I define my original range as equal to a new variable it becomes a vector or array. This then means my output becomes a vector/array I can then pull values from it.
Which if you ask me is stupid all I'm doing is typing z:=x and z is now a vector/array where x wasn't.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
The (undocumented) trick to turn a range (which is kind of an implicit loop and not a set of values) into a vector is not the re-assignment to another variable but the inline evaluation immediately after the definition in the same region. If you would defined x:=0,R/10..R = then x would have been a vector right away.
The trick exists for a very long time (even back in older versions of real Mathcad) but as its undocumented its a matter to be changed without notice. So while its quite convenient, it may be a good idea not to rely on it in important worksheets which are supposed to have a long life span.
