Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Input variable from workspace within a function
Date: Thu, 20 Sep 2007 18:02:25 +0000 (UTC)
Organization: Boston University
Lines: 22
Message-ID: <fcucjg$k1q$1@fred.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-02-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1190311345 20538 172.30.248.37 (20 Sep 2007 18:02:25 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Thu, 20 Sep 2007 18:02:25 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 844160
Xref: news.mathworks.com comp.soft-sys.matlab:429480



I have a variable, var2, in my desktop workspace, which I
can manipulate, declare, and save just fine. 

However, I have a function that utilizes the 'input' command
that asks, for instance:

function data = myfn
     variable1 = input('please input variable1: ');
     if isempty(variable1)
         do some task here
     end
     
     data = somecalc(variable1)
end

However I want to assign 'var2' to 'variable1' within the
function call. Without making it an input to the function (I
sort of just answered my question), is there a way of
addressing the variable workspace outside of the function's
workspace? 

Thanks ...