cancel
Showing results for
Did you mean:
cancel
Showing results for
Did you mean:

## Converting function to array  4-Participant

## Converting function to array

Hi all,

I have a range z from 0 to 11,5m I've created function y(z) I want to extract the values of y(z) as an array and extract the array to Excel.

Is it possible to extract the values as an array without converting z to a vector?

Best regards,

Anders

1 ACCEPTED SOLUTION

Accepted Solutions  21-Topaz I
(To:AJ_10132210)

Hi,

When faced with a range "vector iterator" and a matching "vector" I do this.  A range is different to a vector.

Create a "vector iterator" range iz, and create a matching vector z.  I do this together in a little function unifspace.

You can then iterate through the vector z with the range iterator iz.

WRITEEXCEL is the function to write a spreadsheet of the vector.

You can also use vectorization to create P from z without iz Now you know the difference between a range and a vector there is an undocumented trick in Prime.

If you use an equal sign after the definition of a range it turns it into a vector.  5 REPLIES 5  21-Topaz I
(To:AJ_10132210)

Hi,

When faced with a range "vector iterator" and a matching "vector" I do this.  A range is different to a vector.

Create a "vector iterator" range iz, and create a matching vector z.  I do this together in a little function unifspace.

You can then iterate through the vector z with the range iterator iz.

WRITEEXCEL is the function to write a spreadsheet of the vector.

You can also use vectorization to create P from z without iz Now you know the difference between a range and a vector there is an undocumented trick in Prime.

If you use an equal sign after the definition of a range it turns it into a vector.    4-Participant
(To:terryhendicott)

Hi,

Thank you, it works perfectly!

Best regards,

Anders  23-Emerald II
(To:terryhendicott)

For those of you watching in Mathcad Express 7 ... Stuart  23-Emerald III
(To:AJ_10132210)

Like this? Prime 4 file attached.

Success!
Luc  23-Emerald II
(To:LucMeekes)

Such capability is so useful that I've got a set of related functions in my Default Template. The nice thing about using your matrix(n,1,max) is that it's so simple even I can remember it,  It's simple to make linspace and linrange stand-alone using this expression. Stuart

T is just a transpose function that makes it easier to deal with expressions that may give either an array or a scalar result.  It also helps make nested vector results more compact.  Announcements