remove first two items from list in matlab

You can use the 1:2 indexing to select the first two elements of the list and then remove them using the [] empty brackets.

Here's an example:

main.m
% create a list
myList = [10, 20, 30, 40, 50];

% remove first two items
myList(1:2) = [];

% display the modified list
disp(myList);
134 chars
9 lines

Output:

main.m
30    40    50
15 chars
2 lines

Note: This operation modifies the original list. If you want to keep the original list intact, you can make a copy of it and apply the operation on the copy.

related categories

gistlibby LogSnag