- A separate topic.
- Easy to solve yourself using any search engine.
find missing elements in a matrix
5 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Rashmil Dahanayake
el 19 de Sept. de 2014
Comentada: Rashmil Dahanayake
el 23 de Sept. de 2014
Hi, I have a matrix represents code numbers.
A=[1 2 3 6 7 45 46 47 53 78 80];
B=[55.23 ,74.22]; % B is if same length of A, and contains element by element corresponding data
Say the numbers should be in the range 1:80.
How can I find the numbers which are missing in A.
eg in above case, the expected answer is missing=[4 5 8 9 ... 79]
Then to print a text file
experiment 1 results 55.23
experiment 2 results 442.23
experiment 4 data missing
.
.
experiment 79 data missing
experiment 80 results 442.2
2 comentarios
Stephen23
el 19 de Sept. de 2014
Editada: Stephen23
el 19 de Sept. de 2014
Your edit added "Then print to a text file". This is:
Other users here are not paid to write your code for you, but will happily help if there is something that needs explaining or clarification.
Respuesta aceptada
Más respuestas (2)
Fabio Freschi
el 19 de Sept. de 2014
Try this
A=[1 2 3 6 7 45 46 47 53 78 80];
all = 1:80;
missing = setdiff(all,A);
Fabio
Rashmil Dahanayake
el 19 de Sept. de 2014
Editada: Rashmil Dahanayake
el 19 de Sept. de 2014
0 comentarios
Ver también
Categorías
Más información sobre Function Creation en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!