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

Exporting results of matrics to excel file

YA_10963798
14-Alexandrite

Exporting results of matrics to excel file

I can't export my results to excel file when the results contains more than one matrics .

I am generating excel files for some results using the function(WRITEXCEL). When the matrics is vector which means has only one colunm it easily export it to excel file. However, when the results has more than one colunm like shown below it doesn't work. this error is on page 33. how can I solve that?

YA_10963798_0-1722266042764.png

 

 

 

 

 

 

It shows error 

YA_10963798_0-1722261927805.pngYA_10963798_1-1722261944219.pngYA_10963798_2-1722261958474.png

 

ACCEPTED SOLUTION

Accepted Solutions

Hi,

The message has got it right.

it takes time for the excel file data to be written and to then close the excel file.

Because the two statements follow each other and are trying to write to the same file it tries to write the second data before the first is finished.

My system is a very fast computer and fast solid state hard drives so can do the double write to the same file.

 

You can try to swap the order of the two WRITEEXCEL statements so the first is only writing one cell the stride.

If this does not work you could only use one statement and write just the flattened lengths matrix.

 

 

Cheers

Terry

View solution in original post

10 REPLIES 10

Hi @YA_10963798,

Thank you for your question!

 

I’d like to recommend to bring more context to your initial inquiry. 
Please refer to this guideline to make your questions more likely to receive a quick and useful answer.

 

Furthermore, please consult this Community Search guideline as well, which boosts up your chances of finding a resolution to your topic(s) much faster. Making use of our Knowledge Base

 

Thank you for your participation and please let me know if you need further assistance! 

 

Best regards,

Catalina
PTC Community Moderator
LucMeekes
23-Emerald III
(To:YA_10963798)

So, you are using Prime 9. Should have mentioned that.

1st error: You cannot have the vertical bar character "|" in a file or path name.

2nd error. The variable is undefined. Make sure it is defined. If A.beta is a function (like you use it in the WRITEEXCEL call), then you must use it as a function in the expression above as well. OR vice versa.

3rd error. Q.CPT is a vector of vectors that is a nested array. WRITEEXCEL accepts only flat arrays. You may need to flatten it first.

 

Success!
L:uc

Hi,

Here is one way to flatten a nested matrix, Works only if nested matrix is only one level and all nested matrices are the same size like L.inters

Recovering  the data from a flattened matrix file you need to know the stride as well as the data.

Capture.JPG

 

 

Cheers

Terry

 

Hi,

Noticably faster version of flatten

Capture.JPG

Hi Terry,

I really appreciate your help. I tried to do the same however it did not work. Still showing the same error message.

How can I export the data of such vector to excel. 

YA_10963798_0-1722343466599.png

it should look like the following table:

YA_10963798_1-1722343647563.png

 

LucMeekes
23-Emerald III
(To:YA_10963798)

You should REALLY read the error message that Prime gives...

The pathname of your output file contains illegal characters, remove those vertical bars '|' around the 'l'.

 

Success!
Luc

Hi,

File has the correction to the vertical bar issue.

Go to page 33

Shows how to save stride and flattened matrix Linter in one file.

This is done in two steps.  For saving two bits of information to the same file to work multithreading needs to be turned off.  If multithreading is turned on instead of saving one after the other it will open two processes for the one file and an error on one of them saying the file is open will result.

flatten has one more change that defines all memory for the matrix N which will make function a little bit faster

Capture.JPG

Capture2.JPG

Capture3.JPG

Cheers

Terry

Hi Terry,

 

I hope you are doing well. 

I turned off the multithreading but I still get this error message: the function is used in another process. 

Do you know why? 

Thanks in advance 

Yusra

YA_10963798_0-1722431311562.png

 

Hi,

The message has got it right.

it takes time for the excel file data to be written and to then close the excel file.

Because the two statements follow each other and are trying to write to the same file it tries to write the second data before the first is finished.

My system is a very fast computer and fast solid state hard drives so can do the double write to the same file.

 

You can try to swap the order of the two WRITEEXCEL statements so the first is only writing one cell the stride.

If this does not work you could only use one statement and write just the flattened lengths matrix.

 

 

Cheers

Terry

I see 

Thank you very much I appreciate your amazing help

 

Announcements

Top Tags