Problem with GUI for import .txt file
2 views (last 30 days)
Show older comments
francisco gonzalez
on 8 May 2015
Answered: Walter Roberson
on 8 May 2015
Hellow,
I'm trying to use the explanation of the following link to link through csv, matlab and metatrader. https://www.mql5.com/es/articles/1489
I made the first steps, but when entering the code:
% --- Executes on button press in pushBrowse.
function pushBrowse_Callback(hObject, eventdata, handles)
[fileName, filePath] = uigetfile('*.txt'); % receive and the path from the user
if fileName==0 % if it is canceled
fileName=''; % create an empty name
filePath=''; % create an empty path
end
fullname = [filePath fileName] % form a new name
set(handles.editPath,'String', fullname); % write in the editPath
It gives me the following error:
fullname =
H:\FXPRO4\MQL4\Files\EURUSD.txt
Attempt to reference field of non-structure array.
Error in FromfTo>pushBrowse_Callback (line 107)
set(handles.editPath,'String', fullname); % write in the editPath
Error in gui_mainfcn (line 96)
feval(varargin{:});
Error in FromfTo (line 42)
gui_mainfcn(gui_State, varargin{:});
Error in
@(hObject,eventdata)FromfTo('pushBrowse_Callback',hObject,eventdata,guidata(hObject))
Error while evaluating uicontrol Callback
Therefore, the first step towards choosing the file path is blocked by pressing the Browse button
Anyone know what's wrong?
Thank you very much
5 Comments
Adam
on 8 May 2015
That is just running the code and getting an error though.
Debugging allows you to actually look at the 'handles' variable on the command line if you put a breakpoint in.
Then it will be obviously if 'handles' is what it is supposed to be. The error clearly tells you that 'handles' does not have that field though so double-check your axes tag.
Accepted Answer
Walter Roberson
on 8 May 2015
In step 3 of that document it says to use the visual properties builder to create several objects, including:
Axes: Box – on, FontName – MS Sans Serif, FontSize – 8, Tag - axesChart.
You either did not do that or else you did not set the Tag to be exactly 'axesChart'
0 Comments
More Answers (0)
See Also
Categories
Find more on Graphics Performance in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!