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

Community Tip - You can change your system assigned username to something more personal in your community settings. X

Converting function to array

AJ_10132210
4-Participant

Converting function to array

Hi all,

 

I have a range z from 0 to 11,5m

AJ_10132210_1-1638197472781.png

 

I've created function y(z)

AJ_10132210_0-1638197455199.png

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

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

Capture2.JPG

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.

Capture3.JPG

 

 

Capture.JPG

 

View solution in original post

5 REPLIES 5

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

Capture2.JPG

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.

Capture3.JPG

 

 

Capture.JPG

 

Hi,

 

Thank you, it works perfectly!

 

Best regards,

Anders

For those of you watching in Mathcad Express 7 ...

 

2021 11 30 i.png

 

Stuart

LucMeekes
23-Emerald III
(To:AJ_10132210)

Like this?

LucMeekes_0-1638262650869.png

Prime 4 file attached.

 

Success!
Luc

StuartBruff
23-Emerald II
(To:LucMeekes)

Such capability is so useful that I've got a set of related functions in my Default Template.

 

2021 11 30 f.png

 

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.

 

2021 11 30 g.png

 

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.

 

2021 11 30 h.png

 

 


Top Tags