Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

MATLAB Workspace To simulink Help

Status
Not open for further replies.

illegal121

Member level 2
Member level 2
Joined
Jun 20, 2011
Messages
49
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,288
Location
Oman
Activity points
1,650
hello There...
I want real time data view on Simulink ..
here is my code

Code:
fid=fopen('file.txt');
fseek(fid,94,'bof')
n=0;
for (n=0:6)
    pause(0.5);
    A = fgetl(fid)
    A=str2num(A)
  end
fclose(fid);

this takes line from a text file , I am just stuck that how do I update Base workspace as the loop is running ...
When I ran this it shows a variable A on workspace after the loop finishes means only last value the file reads..
But I want to read all values from file for workspace in order to interface through "from Workspace " block with simulink ...
Hope you people Helps Me Out...
Thanks A Tons ...
 

Hi
Try sim() function of Matlab to execute your model in each iteration of loop. Like
Code:
fid=fopen('file.txt');
fseek(fid,94,'bof')
n=0;
for (n=0:6)
    pause(0.5);
    A = fgetl(fid)
    A=str2num(A)
    sim('your_model');
    % Collect output here.
  end
fclose(fid);
 
thanks ALOOOt...!!
Its working... :)
In my scope(simulink) my values along Y axis is changing ..
Any help that how to chagne X axis of scope with the loop.. so that it looks real time :)
Again thank u ...
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top