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 code

Subject: matlab code

From: Amish Rughoonundon

Date: 6 Aug, 2009 13:27:01

Message: 1 of 3

I have the following function:
<CODE>
function [voltage_csv_data, current_csv_data] = runEventDesign()
    % Switch to project directory
    cd 'C:\Documents and Settings\RughooAm\My Documents\MATLAB\Ray_event_classification'
    
    % Get the simulation data from the csv file
    [voltage_csv_data, current_csv_data] = captureCsv('2009130', 35, 8180);
    
    % Simulate the simulink project
    sim ray_event_classification_test.mdl;
</CODE>

It seems that [voltage_csv_data, current_csv_data] does not get transfered to the main workspace until this function exits. The problem is that the simulink simulation needs to have the voltage and current data in the main workspace before it can execute. Is there any way to force the code to return the values to the main worspace before the simulink simulation code line.
Thanks for the help,
Amish

Subject: matlab code

From: Steven Lord

Date: 6 Aug, 2009 14:01:14

Message: 2 of 3


"Amish Rughoonundon" <amishspam@yahoo.com> wrote in message
news:h5eln5$l1g$1@fred.mathworks.com...
>I have the following function:
> <CODE>
> function [voltage_csv_data, current_csv_data] = runEventDesign()
> % Switch to project directory
> cd 'C:\Documents and Settings\RughooAm\My
> Documents\MATLAB\Ray_event_classification'
>
> % Get the simulation data from the csv file
> [voltage_csv_data, current_csv_data] = captureCsv('2009130', 35, 8180);
>
> % Simulate the simulink project
> sim ray_event_classification_test.mdl;
> </CODE>
>
> It seems that [voltage_csv_data, current_csv_data] does not get transfered
> to the main workspace until this function exits. The problem is that the
> simulink simulation needs to have the voltage and current data in the main
> workspace before it can execute. Is there any way to force the code to
> return the values to the main worspace before the simulink simulation code
> line.
> Thanks for the help,
> Amish

Use SIMSET with the SrcWorkspace option.

--
Steve Lord
slord@mathworks.com

Subject: matlab code

From: someone

Date: 6 Aug, 2009 14:05:20

Message: 3 of 3

"Amish Rughoonundon" <amishspam@yahoo.com> wrote in message <h5eln5$l1g$1@fred.mathworks.com>...
> I have the following function:
> <CODE>
> function [voltage_csv_data, current_csv_data] = runEventDesign()
> % Switch to project directory
> cd 'C:\Documents and Settings\RughooAm\My Documents\MATLAB\Ray_event_classification'
>
> % Get the simulation data from the csv file
> [voltage_csv_data, current_csv_data] = captureCsv('2009130', 35, 8180);
>
> % Simulate the simulink project
> sim ray_event_classification_test.mdl;
> </CODE>
>
> It seems that [voltage_csv_data, current_csv_data] does not get transfered to the main workspace until this function exits. The problem is that the simulink simulation needs to have the voltage and current data in the main workspace before it can execute. Is there any way to force the code to return the values to the main worspace before the simulink simulation code line.
> Thanks for the help,
> Amish

% I'm not sure, but perhaps:
doc assignin
% will help.

% Also, shouldn't your above code be either:
cd C:\Documents and Settings\...\Ray_event_classification
% or
cd ('C:\Documents and Settings\...\Ray_event_classification')

% If you want your code to be transportable,
% you should look into:
doc fullfile
doc fileparts

Tags for this Thread

No tags are associated with 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