Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
Mathematics
General TopicsResearchOperations ResearchStatisticsMathematical LogicNumerical AnalysisUndergraduate MathAlgebra HelpRecreational Math
Math Software
MapleMathematicaMATLABScilabSASSPSS

Math Forum / Math Software / MATLAB / July 2008



Tip: Looking for answers? Try searching our database.

Changing S-function arguments from GUI

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Joseph Stuber - 24 Jul 2008 18:25 GMT
Hi,

I have a simulink model and i want to implement an s-
function to model the changing area of two overlapping
circles.  i would like the user to specify the radius of
the circles from a GUI.  what do i need to code in my GUI m-
file so that the simulink model will pass the user input as
arguments into the s-function?

thanks for your help!

-joseph
Guoliang Zhang - 24 Jul 2008 21:41 GMT
is the mask on the Sfunction block sufficent?

GZ

> Hi,
>
[quoted text clipped - 8 lines]
>
> -joseph
Omur Bas - 28 Jul 2008 07:56 GMT
"Guoliang Zhang" <zhangl@mathworks.com> wrote in message
<g6apdp$nqo$1@fred.mathworks.com>...
> is the mask on the Sfunction block sufficent?
>
[quoted text clipped - 12 lines]
> >
> > -joseph

1. Mask the S-function. Set your variable names to radius1
and radius2.
2. In the GUI callback, write
set_param([<blockname>,'radius1',radius1string)

If you are using edit boxes for setting radii, replace
radius1string with get(hObject,'string'). Blockname is the
full path to the masked S-function block. You'll have better
success if block names do not contain line breaks or special
characters.

HTH,
Omur Bas
www.promodsoftware.com.tr
Joseph Stuber - 28 Jul 2008 15:56 GMT
Omur,

Thank you very much for your help.  I am trying to input
the arguments to my s-function in simulink in the following
way:  I have constant blocks set up (which can have their
values changed from my GUI) fed into the s-function block.  
However, I am recieving an error message.  "Error in port
widths or dimensions." "...the output of port 1 is a 1
dimensional vector with one elements."  I do not see
anything wrong with my simulink blocks.  Is the code
responsible for this error?  How would i go about fixing it?
Thank you very much!

> 1. Mask the S-function. Set your variable names to radius1
> and radius2.
[quoted text clipped - 10 lines]
> Omur Bas
> www.promodsoftware.com.tr
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2010 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.