How to remove the last row in a matrix?

33 次查看(过去 30 天)
Using GUIDE, I have made a table. In that, there is a "pushbutton" if the user wants to remove the rows.
I am not able to remove
% --- Executes on button press in remove_button.
function remove_button_Callback(hObject, eventdata, handles)
% hObject handle to remove_button (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% By default the remove button will only remove the last row in the
% table
dat = get(handles.eptable,'Data');
sz = size(dat);
dat(sz(1),1)=[];
I get the following error:
??? A null assignment can have only one non-colon index.
What is the solution of removing the last row?

采纳的回答

Walter Roberson
Walter Roberson 2014-2-13
dat(sz(1),:) = [];
or
dat(end,:) = [];
  5 个评论
Ashish
Ashish 2014-2-14
Thanks Walter and Jos for the feedback!

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Migrate GUIDE Apps 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by