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
Does anyone know of a good way to pass temperatures into an Excel component? The method of "stripping" the units by dividing by the units doesn't seem to work with temperatures. The workarounds I can think of are not very elegant. Thanks!
Solved! Go to Solution.
Thanks, Valery. I did think of converting K to F in the spreadsheet, but I was hoping there was a way to avoid that step. I guess not.
I think it would be great if the excel component interface would manage the units automatically, but I guess this will have to wait for the future.
Thanks, again.
You welcome!
Second variant
Welcome to the site of the book Thermal Engineering studies with Excel, Mathcad and Internet
and www.wsp.ru
Water Steam Properties for Mathcad 3.1, Excel etc
Thanks very much for this Valery. I didn't know about that site. It looks like a good place for me to remember.
True, but if I want to use T with its units later, they are gone. So, if I need them later in the sheet, your first method is better.
You need to use the inverse unit:
Although the inverse unit exists in Prime, I don't know how to create it. I cannot find it anywhere. I created the one in the attached file by converting a Mathcad 15 worksheet.
Thanks, Richard. So, if I had a sheet with the inverse units in it, you think I could use them to strip the units as they go into Excel? This would preserve the units for use elsewhere in the sheet. But, to make this work, I would have to be using a sheet that was converted from Mathcad 15, correct?
But, to make this work, I would have to be using a sheet that was converted from Mathcad 15, correct?
Yes, but that's why I posted the sheet. You can just copy and paste the inverse units to your sheet.
Hey, thanks Richard. I did the copy and paste and it worked:
And the units of T1 are preserved for use later in the sheet.
Thanks Valery Ochkov and Richard Jackson for your help with this issue! It is appreciated.
Eric Seelye написал(а):
Hey, thanks Richard. I did the copy and paste and it worked:
But it is not good at any education view - better use clear formula!
> But, to make this work, I would have to be using a sheet that was converted from Mathcad 15, correct?
Not necessarily! Only if you insist on postfix notation.
"°F" and also "/°F" are not units (even if they look like units) but they are functions. That was the reason dividing T by °F failed.
But the function is displayed in so called postfix notation (instead of "f(x)" we see "x f"). There seems to be no way to enter that kind of notation in Prime like we were used from Mathcad 15 and below. So the only way to be able to see "T /°F = 100" is to edit a region from an converted worksheet.
But the function "/°F" is there and can be used in normal function notation and you can do that in any sheet - you don't need a converted worksheet for this to work:
The problem is how to enter "/°F" because as soon as you enter "/" you get a fraction. The trick to use "forbidden" characters in a variable or function name is to begin with double quotes and enter the name with all its odd characters
When the cursor is after the last character you press "del" to delete the double quotes
and you have just created a name with special characters in it and can continue by typing "( T ) ="
That way you could use this function in your sheet like
But if you don't want to go through the hassle of having to type that function name, create a function on your own either using the built-in on
or writing it from scratch
and then use it in your sheet the normal way like
Regards Werner
Errata:
After the text "or writing it from scratch" I had inserted the wrong picture. It should have been this one:
Additional general remarks:
Postfix notation seems the only of the for special notations which is available in Prime, too, at the moment.
According to the annotation the converter itself seems to be not aware of that that, even though it creates a correct expression in postfix notation.
Mathcad 15:
Converted sheet (Prime 3):
So using a converted sheet and editing the converted expressions we can use at least postfix notation in Prime sheets:
If anybody finds a way to enter postfix notation in a Prime sheet without having to resort to a converted region and without tampering with the xml-code of the sheet, this sure would be an interesting information to share with us.
Regards, Werner
If anybody finds a way to enter postfix notation in a Prime sheet without having to resort to a converted region and without tampering with the xml-code of the sheet, this sure would be an interesting information to share with us.
That's the easy bit. Use the scaling operator:
The pop up help is kind of useless. The actual help says:"Scales x by y. If y is a function, it is applied to x. Otherwise, x and y are multiplied".
What I couldn't figure out is how to type the inverse temperature function.
> Use the scaling operator:
Wasn't aware of that operator. Strange that it is called "scaling" operator. If I want to scale I'd rather use a normal multiplication. But it can be used with success to replace the postfix notation. Thanks for pointing that out.
The help info seems to be wrong as x obviously can't be a function (at best it could be a function result)
> What I couldn't figure out is how to type the inverse temperature function.
So combined we can now insert a working /°F in a Prime sheet without using a converted sheet.
Werner
So combined we can now insert a working /°F in a Prime sheet without using a converted sheet.
Only if you know the undocumented function exists, and also know some undocumented tricks to create a function name with special characters. The problem with undocumented features is that, as we have learned in the past, they can be taken away
True.
Unfortunately we also learned in the past (and still learn in the present) that software development not always is going in forward direction and that subsequent versions of a piece of software may lose a significant amount of features - documented or not.
Richard Jackson написал(а):
You need to use the inverse unit:
I don't know how to create it. I cannot find it anywhere. I created the one in the attached file by converting a Mathcad 15 worksheet.
Prefix, infix and tree operators in Mathcad 15 and Prime:
> Prefix, infix and tree operators in Mathcad 15 and Prime:
Yes, as was shown in my post from Jun 22, 2016 8:43 PM all those operators are not available in Prime. Only postfix notation is possible and thanks to Richard I now even know how to insert it without using a converted sheet.
Thanks Werner Exinger Valery Ochkov and Richard Jackson for all your help and contributions on this thread. I really learned a lot. Yesterday I had to go look up postfix notation and I discovered I've been using it since the 1980's without knowing it. My HP calculator uses RPN (Reverse Polish Notation) which, it seems, is the same as postfix. So, as they say, you learn something new every day. Thanks guys!