dlmread() error After compiling.

2 Ansichten (letzte 30 Tage)
GO
GO am 30 Apr. 2012
hi
I made a program. it works with no problems when i run it on matlab windows.
However, once i try executing filename.exe after compiling m-files using mcc -m filename.m. it doesn't works.
I found the problem that is about dlmread(). this instruction can not read the 'csv'file, but i could read the 'csv' file on matlab windows as i ran it.
I don't understand why it doesn't work after compiling, because it works with no problem as i run on matlab windows.
if you guys know this problem could you tell me the reason???
Thank You.
  1 Kommentar
Jan
Jan am 1 Mai 2012
Please post the complete line and explain, if you are using relative or absolute paths.

Melden Sie sich an, um zu kommentieren.

Antworten (3)

Walter Roberson
Walter Roberson am 1 Mai 2012

GO
GO am 1 Mai 2012
OK ,I just made simple testfile using dlmread()
Before trying this source, you need to make folder named 'test' here (path='C:\Users\Administrator\Desktop\test\).
next, move this source and any 'csv file' named 'test.csv' that you made to test folder
where you just got made.
this source will excute pretty well on matlab wondows.
But after compfiling using mcc -m filename.m. it doesn't work if you start 'exe' file.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function varargout = aaa(varargin)
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @aaa_OpeningFcn, ...
'gui_OutputFcn', @aaa_OutputFcn, ...
'gui_LayoutFcn', [] , ...
'gui_Callback', []);
if nargin && ischar(varargin{1})
gui_State.gui_Callback = str2func(varargin{1});
end
if nargout
[varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
else
gui_mainfcn(gui_State, varargin{:});
end
% --- Executes just before aaa is made visible.
function aaa_OpeningFcn(hObject, eventdata, handles, varargin)
handles.output = hObject;
guidata(hObject, handles);
% --- Outputs from this function are returned to the command line.
function varargout = aaa_OutputFcn(hObject, eventdata, handles)
varargout{1} = handles.output;
% --- Executes on button press in pushbutton1.
function pushbutton1_Callback(hObject, eventdata, handles)
path='C:\Users\Administrator\Desktop\test\';
result=dlmread([path 'test.csv'],',',0,0);
csvwrite('result.csv',result);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  1 Kommentar
Walter Roberson
Walter Roberson am 1 Mai 2012
You are not writing along the path: you are writing to whichever directory the executable happens to be in.

Melden Sie sich an, um zu kommentieren.


Walter Roberson
Walter Roberson am 2 Mai 2012
Your existing question is still here and still active, and is waiting for your response. Please do not open duplicate questions; it leads to confusion and split efforts. Your duplicate question has been deleted.

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by