Clear Filters
Clear Filters

How do I get the product in Matlab?

1 view (last 30 days)
Ahmad Hijazi
Ahmad Hijazi on 15 Feb 2018
Answered: Niwin Anto on 22 Feb 2018
Hello. Let's say I have: A=get_param('Name/Object1','Value') A=3.3 and B=get_param('Name/Onject2','Value') B=2 so A and B are extracted from Simulink blocks.
How do I make the product of both in Matlab?
I want to define C as the product so at the end I would get C=6.6 Thank you!!

Answers (1)

Niwin Anto
Niwin Anto on 22 Feb 2018
The return value of the 'get_param' is character array. You can use 'str2num()' function to convert it double. Then you can take product.
A = str2num(get_param('Name/Object1','Value'));
B = str2num(get_param('Name/Onject2','Value'));
C = A * B;

Categories

Find more on Simulink Functions in Help Center and File Exchange

Tags

No tags entered yet.

Community Treasure Hunt

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

Start Hunting!