Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
matlab syntax for 'for workspace' in simulink

Subject: matlab syntax for 'for workspace' in simulink

From: Maryam Ahmad

Date: 3 Dec, 2012 13:48:08

Message: 1 of 2

Hello everyone,
Can I please get help with this, I have searched the internet but could not find any information related to what exactly is the syntax for giving a value to the variable of 'for workspace' in simulink.

I am using this syntax in my m-file:
          sim('decoding','simin',mat);

but it's giving the following error:

??? Error using ==> code1 at 6
block_diagram does not have a parameter named 'simin'.

how exactly do i give a parameter to simulink model from the workspace?

Subject: matlab syntax for 'for workspace' in simulink

From: Phil Goddard

Date: 3 Dec, 2012 20:20:39

Message: 2 of 2


Your question isn't clear.

Are you trying to set the name of a variable into a From Workspace block, or are you trying to set a (model's) input parameters when using the sim function?

If the former, then you need to use set_param.
Something like the following (with appropriate modification to your specific model)
set_param('modelname\blockname','VariableName','newvarname')

If the latter, then how to get the allowable model parameters is shown in documentation for sim, but it'll be something like
sim('modelname','ExternalInputs','yourData');

Phil.

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us