dlmread() error After compiling.

5 次查看(过去 30 天)
GO
GO 2012-4-30
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 个评论
Jan
Jan 2012-5-1
Please post the complete line and explain, if you are using relative or absolute paths.

请先登录,再进行评论。

回答(3 个)

Walter Roberson
Walter Roberson 2012-5-1

GO
GO 2012-5-1
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 个评论
Walter Roberson
Walter Roberson 2012-5-1
You are not writing along the path: you are writing to whichever directory the executable happens to be in.

请先登录,再进行评论。


Walter Roberson
Walter Roberson 2012-5-2
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.

标签

Community Treasure Hunt

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

Start Hunting!

Translated by