Rank: Advanced Member Groups: Registered
Joined: 24/02/2010(UTC) Posts: 34 Location: a
|
Units are not simplified (i.e. to ohms etc) from the base SI units, when they are in matrices. This means that I can't really use a vector to return tuples from a function or display numbers with mixed units, as the units become unrecognisable. btw, is there an easy way to copy the smath region, and paste it into this?
|
|
|
|
Rank: Advanced Member Groups: Registered
Joined: 28/08/2014(UTC) Posts: 1,356 Was thanked: 815 time(s) in 516 post(s)
|
Hi. This is my workaround: in the unit placeholder put diag([unit1, unit2, unit3]^T) Best regards. Alvaro.
|
2 users thanked Razonar for this useful post.
|
on 25/08/2020(UTC), on 25/08/2020(UTC)
|
|
Rank: Advanced Member Groups: Registered
Joined: 24/02/2010(UTC) Posts: 34 Location: a
|
That's a very twisted solution! Here's the catch: I want to return a tuple of two values where I don't know what the units will be.
I thought num2str() might be able to help me just return printable strings, but it also returns the expanded base units. num2str(2.3ohm)="{23*'kg*'m^2}/{10*'A^2*'s^3}"
|
|
|
|
Rank: Advanced Member Groups: Registered
Joined: 28/08/2014(UTC) Posts: 1,356 Was thanked: 815 time(s) in 516 post(s)
|
Originally Posted by: crun ... Here's the catch: I want to return a tuple of two values where I don't know what the units will be. ...
Hi. If you want the string with the value and the unit, try this: with this post ( https://en.smath.com/for..._Dimensions-utility.aspx ) you can seek the dimensions of an unit, further, you can add a column in the 'Dimensions matrix with the unit as string for each one dimension and return it in some function UnitString, instead the dimension name. Or can use this if don't want to work with strings: Best regards. Alvaro. Edited by user 25 August 2020 14:18:43(UTC)
| Reason: Not specified
|
|
|
|
Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.