1 Pages (5 items)
Way to reduce expression to it's value? - Messages
#1 Posted: 1/30/2022 2:25:24 PM
Hi,
I'm having an issue with exporting a result of an equation with the Excel I/O Plugin. In my export matrix I have some values that are defined right before, i.e. L_C=1. Others are results of rather long equations, and they're not being exported. If I change the corresponding value in my export matrix to just the result, say 0,4441, it works fine but I need this to happen automatically. Is there a way to turn the result of an equation into just a number, basically rounding to a specific number of digits and making SMath forget where it came from?
I tried XLSX Import/Export but it's even worse, it exports the result as the whole equation and it doesn't work while the spreadsheet is opened, which I really like about Excel I/O.
Thanks in advance!
I'm having an issue with exporting a result of an equation with the Excel I/O Plugin. In my export matrix I have some values that are defined right before, i.e. L_C=1. Others are results of rather long equations, and they're not being exported. If I change the corresponding value in my export matrix to just the result, say 0,4441, it works fine but I need this to happen automatically. Is there a way to turn the result of an equation into just a number, basically rounding to a specific number of digits and making SMath forget where it came from?
I tried XLSX Import/Export but it's even worse, it exports the result as the whole equation and it doesn't work while the spreadsheet is opened, which I really like about Excel I/O.
Thanks in advance!
#2 Posted: 1/30/2022 7:42:02 PM
Hi. The know way to "Way to reduce expression to it's value? " is using eval. Before exporting the data in M to excel, you can ensure that all are numeric and/or string values using 'M:=eval(M)'
Also, you can check taht all are defined values if 'M=' isn't red. If M is
If M is very large, you can check that all values of M are numeric by also evaluating 'max(M)'. If it does not give an error, it is because all the values of M are defined and reals.
That solve the issue?
Best regards.
Alvaro.
Also, you can check taht all are defined values if 'M=' isn't red. If M is
If M is very large, you can check that all values of M are numeric by also evaluating 'max(M)'. If it does not give an error, it is because all the values of M are defined and reals.
That solve the issue?
Best regards.
Alvaro.
1 users liked this post
sergio 2/21/2022 11:38:00 AM
#3 Posted: 1/30/2022 8:04:58 PM
WroteHi. The know way to "Way to reduce expression to it's value? " is using eval. Before exporting the data in M to excel, you can ensure that all are numeric and/or string values using 'M:=eval(M)'
Also, you can check taht all are defined values if 'M=' isn't red. If M is
If M is very large, you can check that all values of M are numeric by also evaluating 'max(M)'. If it does not give an error, it is because all the values of M are defined and reals.
That solve the issue?
Best regards.
Alvaro.
'M:=eval(M)' doesn't change anything and for 'max(M)' I'm getting "Units don't match", in M there is one value without unit, one angle, three values with unit N/N so no unit and another value without unit. Only the first value gets exported. I don't know if uploading my document would help, it's referring to another one with the include plugin and getting values from it and they're both not short.
#4 Posted: 1/30/2022 10:06:58 PM
Wrote
'M:=eval(M)' doesn't change anything and for 'max(M)' I'm getting "Units don't match"
If the values to be exported cannot be evaluated numerically in SMath, what value do you expect Excel to receive? That is, I think you have to identify why you cannot get the maximum of the matrix in SMath and then export its real and well-defined values to Excel.
Although I believe that the plugin can export things that are not evaluated in SMath, what Excel receives is usually well-defined numbers, real numbers without a complex part, without units, and in any case, strings. To ensure that an array is "well defined" in SMath for export to Excel, the test of requesting its maximum discards elements with errors, unevaluated, complex numbers and strings.
To see which values cause problems you can evaluate the array symbolically in SMath, since some cases, such as unit errors, can be inspected that way.
Best regards.
Alvaro.
#5 Posted: 2/21/2022 9:07:31 AM
It would make easier for us to help if you attach a worksheet.
It doesn't have to be the whole worksheet if you are able to reproduce the issue in a small independent block of code.
It doesn't have to be the whole worksheet if you are able to reproduce the issue in a small independent block of code.
If you like my plugins please consider to support the program buying a license; for personal contributions to me: paypal.me/dcprojects
1 Pages (5 items)
-
New Posts
-
No New Posts