How can I use the numeric value of a Physic variable

Im working in a code that works with physycal variables and I need to operate with a physical variable and this function:
7.537326681679638e-004 * exp (0.921 * u) * u
where "u" represents the physican variable.
The physical variables are defined like this Argument 1 = {[1x1 double], 'V'}", so there is a numeric value and its unit, in this example, V ( volts)
When i try to run it, the program complains as follows:
"No matching signature found for exp. exp takes one dimensionless argument.
Argument 1 = {[1x1 double], 'V'}"
I cant find a way to use just the numeric value of the argument. Is there any way to do it?

3 Comments

Try this:
uv = {1};
7.537326681679638e-004 * exp (0.921 * uv) * uv
It doesn't work, it say's:
Illegal use of cell array syntax in declarative construct. Only unit expressions {expression, 'character vector'} may use the '{}' syntax in declarative constructs.
"It says ..." and "when i try to run it" is not useful. Please post the rlevant part of the code and a copy of the complete error message.
There are no "physical variables" in programming languages and you cannot expect the standard operators of Matlab to handle your cell arrays as you expect it.

Sign in to comment.

More Answers (0)

Products

Release

R2018b

Asked:

on 29 Apr 2019

Commented:

on 30 Apr 2019

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!