Welcome Guest! To enable all features please Login. New Registrations are disabled.

Notification

Icon
Error

Login


Options
Go to last post Go to first unread
Offline crun  
#1 Posted : 25 August 2020 08:07:36(UTC)
crun


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?

Smath_Units_Matrices_Bug1.png

Wanna join the discussion?! Login to your SMath Studio Forum forum account. New Registrations are disabled.

Offline Razonar  
#2 Posted : 25 August 2020 10:36:38(UTC)
Razonar


Rank: Advanced Member

Groups: Registered
Joined: 28/08/2014(UTC)
Posts: 1,356
Uruguay

Was thanked: 815 time(s) in 516 post(s)
Hi. This is my workaround: in the unit placeholder put diag([unit1, unit2, unit3]^T)

Clipboard01.jpg

Best regards.
Alvaro.
thanks 2 users thanked Razonar for this useful post.
on 25/08/2020(UTC),  on 25/08/2020(UTC)
Offline crun  
#3 Posted : 25 August 2020 14:00:33(UTC)
crun


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}"
Offline Razonar  
#4 Posted : 25 August 2020 14:13:01(UTC)
Razonar


Rank: Advanced Member

Groups: Registered
Joined: 28/08/2014(UTC)
Posts: 1,356
Uruguay

Was thanked: 815 time(s) in 516 post(s)
Originally Posted by: crun Go to Quoted Post
...
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:

Clipboard01.jpg

Best regards.
Alvaro.

Edited by user 25 August 2020 14:18:43(UTC)  | Reason: Not specified

Users browsing this topic
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.