How to delete a cell in gui
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
leydy Garcia
el 18 de Feb. de 2020
Respondida: Walter Roberson
el 19 de Feb. de 2020
Hi, I want to delete a line from a plot in GUI. To do that, I have created the following code:
line1=num2str(get(handles.plotHandles,'XData'));
delete(line1)
where line1 is composed of 2x1 cells = [ 1x2 double]
[1x2 double]
it seems something is wrong here but I cannot find the solution. I am getting the following error:
Any suggestion to fix this error?
Undefined function 'abs' for input arguments of type 'cell'.
Error in num2str (line 66)
xmax = double(max(abs(widthCopy(:))));
Error in Loading_Well_logs>pushbutton8_Callback (line 1931)
line1=num2str(get(handles.plotHandles,'XData'));
Error in gui_mainfcn (line 95)
feval(varargin{:});
Error in Loading_Well_logs (line 42)
gui_mainfcn(gui_State, varargin{:});
Error in @(hObject,eventdata)Loading_Well_logs('pushbutton8_Callback',hObject,eventdata,guidata(hObject))
Error while evaluating UIControl Callback
0 comentarios
Respuesta aceptada
Walter Roberson
el 19 de Feb. de 2020
When you get() a property from more than one graphic object, you get back a cell array in response. You are trying to use num2str on that cell, but cell cannot be converted to characters by num2str.
The Xdata associated with a line plot is the X coordinates in data units. You are taking the data units and trying to convert the coordinates to characters. Then you pass the characters to delete(). When you pass characters to delete() that is interpreted as a request to delete a file named by the characters.
If you want to remove graphics objects from display and memory
delete(handles.plothandles)
0 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Data Type Conversion en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!