from
Ideal Rankine Cycle ASP.NET Webpage
by David Forstot
Integration of MATLAB created .NET component with web application using VB in ASP.NET
|
| build_mcode.m |
%% Build Script
% This script will build the mcode for the Rankine Web demo.
%
% This demo shows web deploytment of MATLAB using Builder for .NET.
% See the included readme.doc for more information.
%
% The bulk of the demo is written in VB and referenced in the
% Visual Studio project. The example MATLAB code used,
% "rankine.m," was created my Mike Agostini.
%
% David Forstot
% Copyright 2006 The MathWorks, Inc.
% This code is provided for example only.
%% Determine path names
workdir = pwd();
basedir = fileparts(workdir);
outdir = fullfile(basedir, 'RankineWebSite', 'Bin');
dnetdir = fullfile(workdir, 'rankine_component');
%% Determine file names
mfile_rankine = fullfile(workdir, 'rankine.m');
mfile_steam = fullfile(workdir, 'XSteam.m' );
dnetdll = fullfile(dnetdir, 'rankine_component.dll');
%% Verify mfiles can be found
if (exist(mfile_rankine, 'file') ~= 2)
error('Unable to find mfile rankine.m');
end
if (exist(mfile_steam, 'file') ~= 2)
error('Unable to find mfile XSteam.m');
end
%% Create directories if needed
if (exist(outdir, 'dir') ~= 7)
mkdir(outdir);
end
if (exist(dnetdir, 'dir') ~= 7)
mkdir(dnetdir);
end
%% Build .NET Assembly
disp('Compiling .NET Assembly...');
eval(['mcc -d ' dnetdir ' -W ''dotnet:rankine_component,' ...
'rankineclass,0.0,private'' -T link:lib ' mfile_rankine]);
% verify assembly was created
if exist(dnetdll, 'file') ~= 2
error('Failed to successfully compile .NET assembly.');
else
fprintf('\tDone\n');
end
%% Copy .NET Assembly to Output
Copy1 = copyfile(dnetdll, fullfile(outdir, 'rankine_component.dll'));
if Copy1 ~= 1
error('Unable to copy .NET Assembly to output directory.');
end
%% Clean up
clear Copy1 basedir dnetdir dnetdll ...
mfile_rankine mfile_steam outdir workdir;
|
|
Contact us at files@mathworks.com