Community Tip - Learn all about PTC Community Badges. Engage with PTC and see how many you can earn! X
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?
It shows error
Solved! Go to Solution.
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
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,
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.
Cheers
Terry
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.
it should look like the following table:
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
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
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