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 everyone,
I need to change an array into vector in Prime 10 .
Can you show me how to solve this? Prime 10 is attached
Solved! Go to Solution.
Terry already pointed you to the missing assignment.
But the first, simpler version of "vec" you show in your picture should work equally well!
Stuarts version has the benefit that it also unravels recursively nested vectors. But thats not necessary when you just want to turn a range into a vector. You also should not keep both versions of "vec" with the same name in your sheet. The call of "vec" in the "stack" function of the second "vec" variant would call the first variant and not itself as it should be. Thats the reason I renamed Stuarts function to "vec2" in the picture below which is just here to demonstrate what Stuarts function is capable of:
The simple "vec" is only good for turning a range into a vector.
Stuarts extended version will also deal with nested matrices.
It will not deal with matrices containing ranges, though 😉 😈
Dealing with this moloch, too, would make it necessary to add Stuarts "IsRange" function alongside the "IsArray".
Z is already a vector not a range.
Cheers
Terry
Hi Terry,
Thank you for replying .. actually this is the original sheet
and it tells me I need to have ztips as vector
the above sheet was a simplified sheet to explain what I need to do ..
Thank you Terry that was helpful
Terry already pointed you to the missing assignment.
But the first, simpler version of "vec" you show in your picture should work equally well!
Stuarts version has the benefit that it also unravels recursively nested vectors. But thats not necessary when you just want to turn a range into a vector. You also should not keep both versions of "vec" with the same name in your sheet. The call of "vec" in the "stack" function of the second "vec" variant would call the first variant and not itself as it should be. Thats the reason I renamed Stuarts function to "vec2" in the picture below which is just here to demonstrate what Stuarts function is capable of:
The simple "vec" is only good for turning a range into a vector.
Stuarts extended version will also deal with nested matrices.
It will not deal with matrices containing ranges, though 😉 😈
Dealing with this moloch, too, would make it necessary to add Stuarts "IsRange" function alongside the "IsArray".
Thank you Werner .. Always an answer with thorogh explaination.
@Werner_E wrote:
Terry already pointed you to the missing assignment.
But the first, simpler version of "vec" you show in your picture should work equally well!
Stuarts version has the benefit that it also unravels recursively nested vectors. But thats not necessary when you just want to turn a range into a vector. You also should not keep both versions of "vec" with the same name in your sheet. The call of "vec" in the "stack" function of the second "vec" variant would call the first variant and not itself as it should be. Thats the reason I renamed Stuarts function to "vec2" in the picture below which is just here to demonstrate what Stuarts function is capable of:
The simple "vec" is only good for turning a range into a vector.
Stuarts extended version will also deal with nested matrices.
It will not deal with matrices containing ranges, though 😉 😈
Dealing with this moloch, too, would make it necessary to add Stuarts "IsRange" function alongside the "IsArray".
Not necessary, because IsRange itself is defined in terms of existing types, but certainly jolly useful. By one of those serendipitous coincidences, I included a range-expanding version of vec a few weeks ago when I was creating a new Library function worksheet that deals with ranges. I usually use a version of vec that treats strings as vectors-in-waiting ... saves me having to remember what I called str2chr ... but there are also occasions when I want the string returned and it probably won't suit most people's needs. So, here are vec and vecs:
Stuart