This question is closed. Reopen it to edit or answer.

is there a way of scanning an array to find out what there is in there so i dont reinsert the same variable in there?

1 view (last 30 days)
ME on 13 Mar 2015
Closed: MATLAB Answer Bot on 20 Aug 2021
i have an array numbers = [];, i want to create a while loop which inserts numbers into the array. i do not want repeated numbers in the array so if the number already exists i do not want to insert it into the array.
ME on 16 Mar 2015
so i have an array pairs with dimenstions 90x2 which appears to be like this 3 7 3 8 3 9 3 10 4 1 4 2 4 3 4 5 and so on I want to create a loop which scans through each row in the array and if the value matches the array pse I will disregard it otherwise insert it into new array called new.

Answers (2)

Adam on 17 Mar 2015
In response to your latest comment...
C = setdiff(A,B,'rows');
should do what you want, assuming your pse array also has 2 columns and that you wish to remove rows from A (your dimensions array) in which the pair of values matches your pse array.
Is your pse array just 1x2 or does it have multiple pairs?


Community Treasure Hunt

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

Start Hunting!