dlmread() error After compiling.

조회 수: 11 (최근 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.

카테고리

Help CenterFile Exchange에서 Spreadsheets에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by