Prev: How to construct a closed B-spline curve approximation
Next: Fixed time step output for stiff model
From: Joshua Martin on 21 Jun 2010 22:28 "Guy " <grigot(a)nospam.com> wrote in message <gvol16$ovn$1(a)fred.mathworks.com>... > Hello all, > > I'm trying to include data files (images/plain text) into the executable that mcc creates. This all works when I do not include the CTF archive in the executable. All files added with the -a option are then placed in the directory ./exe_mcr/ . If I however include the CTF archive in the executable (no separate .ctf file), the executable can't seem to find the data files. I know they are included in the executable, since its size has grown to the expected size. Is there a special directory to use, or is something else the problem? Thanx in advance! > > Guy I know this is old, but in case it's still unsolved... If it's just a data file that you want the contents of, you can read the contents like this: data = fileread('mydatafile.txt'); If you've imbedded something you want to be available to run outside matlab, you need to write it out to file. I did this with an executable which I included with -a. % Read the data & write it out to file: fcontent = fileread('myfile.exe'); % Read file contents from ctf archive fid = fopen([pwd filesep 'outfile.exe'],'w','n'); % Create new file in current directory fwrite([pwd filesep 'outfile.exe'],fcontent,'char'); % Pass file contents through fclose(fid); % close file % Open the file from the working directory with the SYSTEM command [status, result] = system([pwd filesep 'outfile.exe']); Hope this helps.
From: Joshua Martin on 21 Jun 2010 22:49 Correction, I made a hasty paste and got the fwrite call wrong. That code block should read: % Read the data & write it out to file: fcontent = fileread('myfile.exe'); % Read file contents from ctf archive fid = fopen([pwd filesep 'outfile.exe'],'w','n'); % Create new file in current directory fwrite(fid,fcontent,'char'); % Pass file contents through fclose(fid); % close file
|
Pages: 1 Prev: How to construct a closed B-spline curve approximation Next: Fixed time step output for stiff model |