dlmread() error After compiling.

2 visualizaciones (últimos 30 días)
GO
GO el 30 de Abr. de 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 comentario
Jan
Jan el 1 de Mayo de 2012
Please post the complete line and explain, if you are using relative or absolute paths.

Iniciar sesión para comentar.

Respuestas (3)

Walter Roberson
Walter Roberson el 1 de Mayo de 2012

GO
GO el 1 de Mayo de 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 comentario
Walter Roberson
Walter Roberson el 1 de Mayo de 2012
You are not writing along the path: you are writing to whichever directory the executable happens to be in.

Iniciar sesión para comentar.


Walter Roberson
Walter Roberson el 2 de Mayo de 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.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by