Fixunknowns function resulting logical rows
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Randi Pratama
el 16 de Ag. de 2018
Editada: Randi Pratama
el 16 de Ag. de 2018
Hello everyone,
Say Num is matrix with these numbers,
1 2 NaN 3
4 5 NaN NaN
NaN 3 2 3
And if fixunknowns used on Num, it will result like this,
1.0000 2.0000 2.0000 3.0000
1.0000 1.0000 0 1.0000
4.0000 5.0000 4.5000 4.5000
1.0000 1.0000 0 0
2.6667 3.0000 2.0000 3.0000
0 1.0000 1.0000 1.0000
Is there any way to get rid those 1 and 0 (logical) rows? If so please kindly answer this question, or guide me to the documentation if it's available.
Thank you,
Randi
0 comentarios
Respuesta aceptada
Stephen23
el 16 de Ag. de 2018
Editada: Stephen23
el 16 de Ag. de 2018
Where M is the output matrix:
new = M(1:2:end,:)
4 comentarios
Stephen23
el 16 de Ag. de 2018
Editada: Stephen23
el 16 de Ag. de 2018
"Just a little bit curious, how is it works?"
The fixunknowns help clearly describes the output matrix: you only want every second row. This is easy to do with indexing (as my answer shows). Using indexing is one of the most basic MATLAB operations, as shown in the introductory tutorials:
And in more detail here:
The indexing in my answer simply uses the colon operator to generate a row index selecting every second row, starting from the first row, and going until the end row. The colon for the column index means "all columns" of the matrix.
"I've tried a bigger matrix with inf number on it and it doesn't work"
Indexing works for all MATLAB arrays, regardless of their size. I have no idea what code you tried, how you used Inf, or what "it doesn't work" means. If you want help please show the code you tried and explain what you expected.
Randi Pratama
el 16 de Ag. de 2018
Editada: Randi Pratama
el 16 de Ag. de 2018
Más respuestas (0)
Ver también
Categorías
Más información sobre Define Shallow Neural Network Architectures 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!