Thread Subject:
I can not see my variables by using parfor ?

Subject: I can not see my variables by using parfor ?

From: mahdi roozbhani

Date: 13 Mar, 2012 14:52:13

Message: 1 of 2

My codes are as follows: I created a function and after that I used the parfor.

function [varargout] = mahdi(i)
eval(['A_' num2str(i) ' = [' num2str(i) ']']);
end

parfor i = 1:8
 mahdi(i);
end

The problem is that I can not access to my variables in Workspace (My workspace is empty). The variables are just shown in Command Window. What can I do to deal with it ?

Subject: I can not see my variables by using parfor ?

From: Sadik

Date: 13 Mar, 2012 23:26:19

Message: 2 of 2

Mahdi,

You should explicitly prepare the output of your function. Here is an approximation to what you would like to do.

Your function:

function varargout = mahdi(i)
varargout{1} = i;

Command window code:

for i = 1:5
     eval(['A_' num2str(i) ' = mahdi(' num2str(i) ');'])
end

I assume this is a starter for the big thing you would eventually like to do.

Best.

Tags for this Thread

Everyone's Tags:

Add a New Tag:

Separated by commas
Ex.: root locus, bode

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.

Tag Activity for This Thread
Tag Applied By Date/Time
parfor Mahdi Roozbahani 13 Mar, 2012 10:54:15
variable access Mahdi Roozbahani 13 Mar, 2012 10:54:15
rssFeed for this Thread

Contact us