cavecrickett
Computer
- Mar 23, 2005
- 3
I have a 2 simple m-files that I need compiled into an exe. My budget can't afford to purchase the Matlab Compiler for this little project. I have been working with Octave / Scilab / Freemat to try to get this file to convert and compile. I have had no luck. It seems there are too many non compatible functions between matlab and the OSS versions. The main problem seems to be the uigetfile dialog box and file i/o functions.
This code isn't mine and I'm a noob to Matlab.
My question is... Is there any free compilers / good FAQ that will help me in this situation? I'm about out of options here. If this job look as simple as I think it is, can someone compile it for me? Karma Opportunity!
Here is the code:
Code and Data file 8MB
I have a data file if someone wants to try this out.
getertblk.m
pltall.m
This code isn't mine and I'm a noob to Matlab.
My question is... Is there any free compilers / good FAQ that will help me in this situation? I'm about out of options here. If this job look as simple as I think it is, can someone compile it for me? Karma Opportunity!
Here is the code:
Code and Data file 8MB
I have a data file if someone wants to try this out.
getertblk.m
Code:
%quick test file to try and pull 3d values from img plot for eet modeling
%
%Clark Scott
clear all
%% Get .img file name %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
[fnam fdir]=uigetfile('*.img','*.img');
fid=fopen([fdir fnam],'rt');
%% Get number of x y and z nodes %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
temp=[fliplr(deblank(fliplr(fgetl(fid)))) ' '];
while temp(1)~='t';temp=[fliplr(deblank(fliplr(fgetl(fid)))) ' '];end;
nx=str2num(deblank(temp(end-2:end)));
temp=fgetl(fid);
ny=str2num(deblank(temp(end-2:end)));
temp=fgetl(fid);
nz=str2num(deblank(temp(end-2:end)));
fprintf(1,'the vales for nx ny and nz are; %4d %4d %4d \n Continue? \n',nx,ny,nz);
drawnow
pause
%% Show iteration list %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
blkpos=[];itnvec=[];curpos=0;
while ~feof(fid)
tempold=temp;
temp=[fliplr(deblank(fliplr(fgetl(fid)))) ' '];
while temp(1)~='i' & ~feof(fid)
tempold=temp;
temp=[fliplr(deblank(fliplr(fgetl(fid)))) ' '];
end
if ~feof(fid)
blkpos=[blkpos ftell(fid)];
delcur=ftell(fid)-curpos; %skip most of the data block to make listing faster
curpos=ftell(fid);
fseek(fid,floor(delcur*.95),0);
itnvec=[itnvec str2num(temp(12:15))];
disp([temp(1:15) ' - ' tempold]);
end
end
itnvec(1:5)=1:5;
disp(' ')
%% Find location of given iteration block and read data %%%%%%%%%%%%%%%%%%%%%%%%%%
itn=input('Which iteration number do you want? ==> ');
if ~isempty(itn)
idn=find(itnvec==itn);
fseek(fid,blkpos(idn),-1);
for l=1:nz
temp=[fliplr(deblank(fliplr(fgetl(fid)))) ' '];
disp(temp);
for col=1:ny
coltemp=fscanf(fid,'%d',[1]);
X(:,col,l)=fscanf(fid,'%f\n',nx);
end
end
X=flipdim(X,3);
X=flipdim(X,1);
disp(['Finished loading iteration #' num2str(itn) ' from file ' fnam]);
else
disp(['No iteration block chosen' ' from file ' fnam]);
end
pltall.m
Code:
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%pltall.m - a quick and dirty plotting routine for MPT3D .img files
%% get base number of plot wanted
%% 1 - X-Direction Resistivities
%% 2 - Y-Direction Resistivities
%% 3 - Z-Direction Resistivities
%% 4 - Geometric Mean Resistivities
%% 5 - Vertical/Horizontal Anisotropy
%% 6 - Output Y_direction parameter info**
%% 7 - Output Y_direction parameter info**
%% 8 - Output Z_direction parameter info**
%% ** - Last iteration only
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
help pltall %% Show above
if ~exist('X');getertblk;end %%get data (This script clears variable space before running)
%% Get info from user %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
disp(' ')
itn=input('Which base number do you want? (1:5)==> ');
disp(' ');
plnor=round(input('Which plane orientation (1-XZ, 2-YZ, 3-XY)? ==> '));
if plnor<1 | plnor>3 | isempty(plnor);plnor=1;disp('Orientation defaulted to XZ');end;
disp(' ');
fprintf(1,'the vales for nx ny and nz are; %4d %4d %4d \n',nx,ny,nz);
drawnow
disp(' ');
disp('Which plane do you want from this orientation? Number');
plnnum=input('between 1 and values given above ==> ')
clc
temp=['XZ';'YZ';'XY'];
disp(['Program will plot plane ' num2str(plnnum) ' in the ' temp(plnor,:) ' orientation' ]);
disp(['from all iterations in the ' fnam ' file' ]);
disp(' ');
disp('Continue?');
pause
%%Get plot params %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
itn=[0+itn:10:itnvec(end)];
if length(itnvec)/5<10
ncol=3;
else
ncol=4;
end
nrow=ceil(length(itn)./ncol);
ncol=7;
nrow=3;
%% Loop over iterations and plot %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
figure;
for j=1:length(itn)
idn=find(itnvec==itn(j));
fseek(fid,blkpos(idn),-1);
for l=1:nz
temp=[fliplr(deblank(fliplr(fgetl(fid)))) ' '];
% disp(temp);
for col=1:ny
coltemp=fscanf(fid,'%d',[1]);
X(:,col,l)=fscanf(fid,'%f\n',nx);
end
end
%% Get plane form block (stored as 3-D array with dimension order as X Y Z
if plnor==3
d=(squeeze(X(:,:,plnnum)));
elseif plnor==2
d=(squeeze(X(plnnum,:,:)));
else
d=(squeeze(X(:,plnnum,:)));
end
%% Plot data
d=d';
subplot(nrow,ncol,j);
pcolor((d));
axis ij
V=[1 1000];
% if j>20
caxis(V)
% end
shading interp;axis equal;colorbar;
% if j<3
% V=caxis;
% end
title(['itr #' num2str(j-1) ', Block#' num2str(itn(j))],'interpreter','none');
% ylabel('Z');xlabel('X');
drawnow
end
set(gcf,'position',[1 1 1280 1024])
gtext(['Savage - ' fnam],'interpreter','none','fontsize',16);
%ptflg=0;
%home
%ptflg=input('Do you wish a JPG image ([Y]/N) > ','s');
%if isempty(ptflg) | ptflg=='Y' | ptflg=='y'
% set(gcf,'PaperPositionMode','auto');
% print('-djpeg99',['plot' fnam]);
% close
%end
disp(['finished ' fnam]);