Community Tip - Did you get an answer that solved your problem? Please mark it as an Accepted Solution so others with the same problem can find the answer easily. X
Hello to everybody. I am a user of MATHCAD Prime 8.0
I defined a matrix as a result of computations performed in my code, where three columns have been filled with frequency (in Hz or sec-1), and the real and imaginary part of a wave-vector (k' and k'') and several lines (801).
I was firstly surprised to see that if I define each column in a loop I receive back the notification that the variable has been "re-defined". The loop is below, with green-circled matrix element that receive this comment
In spite of this, the matrix is correctly filled, as I check by using the statement "K=".
On the other hand, when I try to save data in a file, I tried to use both "WRITETEXT" and "WRITEFILE", but the result is that the "K" matrix has no compatibility because of the units (see below)
Now, the three columns have different physical dimensions, but they are correctly defined and I already used this statement in past releases (MATHCAD 15, before the PRIME) without any negative comment.
Do you see anything wrong in my statements?
Unfortunately you can only export data without units. The matrix must be dimension-less, scalar values only!
You can use something like
to strip the units. You have to use vectorization and be aware, that Prime would use the standard/default units only, not the ones you may have used when your values were defined (12 min would end up as 720 in the file).
I already used this statement in past releases (MATHCAD 15, before the PRIME) without any negative comment.
NO! You didn't!
MC15 is still superior to Prime and more comfortable to use, but you sure did not use this statement that way in good old MC15!
1) Neither WRITETEXT nor WRITEFILE were implemented in MC15 (we had READFILE, though)
2) MC15 would not allow matrices with quantities of different dimensions (units)
3) MC15 did not provide export functions which would export the units as well. WRITEPRN, WRITEBIN, WRITEEXCEL ... all of them would refuse to export a matrix which contained units. The error message is a bit more meaningful in MC15
Thank you for your reply.
In fact, you are right, the files I did previously with MCAD 15 did not contain any physical unit, but just numbers!
So far, using units is very convenient from a physical standpoint to avoid ambiguities in the solution of a problem, and it is a pity that what you calculated before cannot be saved in a file with proper units. Actually, the matrix can include them. Then, I am forced in re-defining some quantities without units just to export the results.
Thank you very much for your help, now I shall try this solution.