I am trying to make in Matlab, a GUI, that the user enters points and the relationship between them. it also introduces the map photo (png image) and the scale for the axes (ax x will be from 0 to scale). At the end (after entering all the input data) I want to show the user an image with all the nodes and the connection on it.
I have 5 matlab files - screen1.m, screen2.m, screen3.m, screen4.m, globalParams.m
in globalParams I have global options, so I can use them from the screen GUI to the on-screen GUI. on screen 1, the user enters the number of nodes (for example, 5), and also enters the card. when he clicks the "Next" button, the callback function calls " screen2();". in screen2.m the user enters the coordinate (x, y), and when he clicks the "Next" button, the callback function calls " screen3();". on screen 3, the user updates all connections between all nodes. upon completion, he clicks the Finish button, and the callback function calls " screen4". in screen4, I added in the GUI axis, and there I did " imshow" ..
but the real thing that I want to do is to change the axes to a scale (from 0 to 1), I also want to put the image (I did it with imshow), and the last and most important thing I want to put to the image, these are the nodes and lines between them (if the user adds a connection between node i and node j, so there will be a line between them in the image. It is possible to put lines and nodes with different colors so that we can distinguish between lines and nodes)
on on screen 4 we have: xNodes and yNodes - 2 arrays for the nodes "x" and "y" of the axes. ((xNodes (1), yNodes (1) is node 1). We also have Scale and fullPathNamefor the image name. We also have hopsMatrix this is a 2D array, if hopsMatrix (i, j) = 1 there is a relationship between i to j.
some code:
in screen1, the loading image and numOfNodes and scale:
% --- Executes on button press in pushbutton2.
function pushbutton2_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton2 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global fullPathName;
[fileName pathName] = uigetfile({'*.png'},'File Selector');
fullPathName = strcat(pathName, fileName);
imshow(fullPathName);
% --- Executes on button press in pushbutton1.
function pushbutton1_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global numOfNodes;
global scale;
scale = str2num(get(handles.edit1, 'string'));
numOfNodes = str2num(get(handles.edit2, 'string'));
in screen4, where I have all the inputs, and I want to put the nodes into the map (I don't know how to do this, so now this is the code):
% --- Executes just before screen4 is made visible.
function screen4_OpeningFcn(hObject, eventdata, handles, varargin)
% This function has no output args, see OutputFcn.
% hObject handle to figure
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% varargin command line arguments to screen4 (see VARARGIN)
global fullPathName;
global xNodes;
global yNodes;
global scale;
global hopsMatrix;
img = imread(fullPathName);
imshow(fullPathName);