MATLAB: Variable disappears when using it

import variableworkspace

Hi, I've imported rows and columns of data from an excel file. It shows up as a variable in my workspace. When I call the variable in the Command Window, it shows up. However, when I input or try to apply the variable in a matlab code in the editor window and hit "Run", the variable disappears when the simulation gets to that line of code.
order=3;
framelen=61;
y=sgolayfilt(var1,order,framelen)
,where var1 is the imported matrix data I am trying to use. New to Matlab and wondering if I am supposed to save the variable, call it, or load it into my code.
Thanks in Advance!

Best Answer

@Vicki Ly: the best answer ( best in the sense fastest, neatest, least buggy, best practice as recommended by the MATLAB documentation and all MATLAB experts) is to simply pass your data as input and output arguments. For this you will need to define your function with input and output arguments. See the function help for more information on how to do that:
The introductory tutorials teach how to call functions correctly (with input and output arguments), and are highly recommended for all beginners:
"However, when I input or try ... and hit "Run","
That awful "Run" button has caused a continuous stream of beginners so much confusion because they try to run some function which requires inputs but that badly designed "Run" button does not provide their function with its required inputs. The best thing that can happen is that TMW removes the "Run" button from the toolbar. Until then the best thing that you can do is to ignore that button. Do NOT use it. When you want to run code, simply execute it from the command line by typing the script name, or the function name (along with any required input and output arguments) and then press enter. Or call it from another script/function/callback/class/.... but do NOT use that button. How to run scripts/functions is also explained in the introductory tutorials, which I highly recommend that you work through to learn basic MATLAB usage.