How to use "From Workspace Block" in Simulink???

Status
Not open for further replies.

Luckybuilding

Member level 1
Joined
Oct 8, 2005
Messages
40
Helped
2
Reputation
4
Reaction score
1
Trophy points
1,288
Activity points
1,615
Hi, all
I have problem on using "From Workspace" Block of Matlab simulink.
When I use it in a model file. it gives me error.

I want to import an array of signal data ( in time domain) to a model.

Can anyone help me using this block of simulink?

Please, give me a sample model using this block if it is possible.

Thanks
 

Re: How to use "From Workspace Block" in Simulink?

Hi, you should create a structure or a matrix following the format that the block needs.

The format required for a matrix is var = [TimeValues DataValues], a simple code to implement this in matlab script is:

time = 1:0.1:2*pi;
data = sin(time);
VAR = [time; data]'

After that, you set the parameter 'Data' of the "From Workspace" equals to VAR. Similar procedure can be done to create a structure.
 
worked well.
thanks very much.

should I change time settings of the model file or not??
 

Re: How to use "From Workspace Block" in Simulink?

Hi,

The sample time of the block should be the same time used in the data input, 0.1 in the previous example (time = 1:0.1:2*pi

The time configuration for the simulation could be changed too, but generally I setup it as "auto".
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…