How to add rows in a gui uitable when adding a new line to a plot from a pop-up menu
Ältere Kommentare anzeigen
I just lost all the question i just asked so I will try and write this really quickly:
First problem is that when i select a new species from my pop-up menu which plots a new line on my axes, the uitable replaces my previous plots data not adding a new row of data. How would i make my loop add a new row for each plot i add to the axes?
Second problem is that the auto-size feature for the uitable means that all of the data is not seeable without a scroll bar, is there a way to make the uitable sort of "fit-to-page".
here is my code:
function Start_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 Start (see VARARGIN)
% Choose default command line output for Start
handles.output = hObject;
% Update handles structure
guidata(hObject, handles);
%
[num, txt, raw] = xlsread('Speciesdata.xlsx',1,'a2:f18');
set(handles.bigbox,'UserData',num);
set(handles.popupmenu1, 'String', txt);
set(get(handles.plot_area,'XLabel'),'String','Temperature ()')
set(get(handles.plot_area,'YLabel'),'String','Saturation Pressure ()')
function popupmenu1_Callback(hObject, eventdata, handles)
% hObject handle to popupmenu1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: contents = cellstr(get(hObject,'String')) returns popupmenu1 contents as cell array
% contents{get(hObject,'Value')} returns selected item from popupmenu1
contents = get(handles.popupmenu1,'Value');
num = get(handles.bigbox,'UserData');
if contents < 17
n = contents;
set(handles.uitable1, 'Data', num(n,1:5));
else n = 17;
end
t = num(n,4):4:num(n,5);
y = 10.^(num(n,1) - (num(n,2)./(num(n,3) + t)));
line(t,y);
Any help would be appreciated!
Extra questions: Is there a way to limit the amount of line plots allowed on an axes? Is there a way to make the colour of the line alternate?
Is there a way to have "static text" in the table? As a way to label the columns and rows?

%
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu Creating, Deleting, and Querying Graphics Objects finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!