Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: MATLAB programming script
Date: Tue, 4 Jan 2011 14:06:05 +0000 (UTC)
Organization: AXON' CABLE LTD
Lines: 27
Message-ID: <ifv9gd$qgf$1@fred.mathworks.com>
References: <ifv35s$497$1@fred.mathworks.com> <ifv5n0$hso$1@fred.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-03-blr.mathworks.com
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1294149965 27151 172.30.248.38 (4 Jan 2011 14:06:05 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Tue, 4 Jan 2011 14:06:05 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 2613677
Xref: news.mathworks.com comp.soft-sys.matlab:700164

"Husam Aldahiyat" wrote in message <ifv5n0$hso$1@fred.mathworks.com>...
> "Chris McCorquodale" wrote in message <ifv35s$497$1@fred.mathworks.com>...
> > Hi,
> > 
> > I am doing analysis on a component that can be made of different materials and I have a script that works with FEA package comsol when a material is defined in comsol. However, what I want to do is define the material in the matlab interface (by means of m-file) and then run everything from matlab.
> > 
> > I have an m-file called material_copper which has all the relevant properties in it. The script works when m-file material_copper is embedded in it, but in the matlab interface I want to define the material as material_copper and have simply "material" written in the script at the appropriate part (this way i can define material as material_copper or material_steel etc etc). But when I write material=material_copper in the matlab interface, I get the following error...
> > 
> > ??? Attempt to execute SCRIPT material_copper as a function:
> > C:\COMSOL35a\material_copper.m
> > 
> > Can anyone help here?
> > 
> > Thanks in advance,
> > 
> > Chris
> 
> You can't do it in the interface, you'll need to rename the file.

Hi Husam, thanks for your answer. Im a bit lost though, can you expand? How cant it be done in the interface? What will renaming the file do?

I mite have complicated things by going into too much detail. Basically all I want is my long script to have a prompt in it (e.g. material) and when it reaches this line in the script it executes the m-file that I assign that prompt to.

So if material=material_copper , then it will exectute the material_copper m-file when it reads "material" in the long script.

Thanks,
Chris