Feeding index returned by find in another matrix
    3 visualizaciones (últimos 30 días)
  
       Mostrar comentarios más antiguos
    
    Riccardo Tronconi
 el 1 de Oct. de 2021
  
Dear Guys, I have an array 3x3 a [3x2]
a=[NaN,NaN; NaN,2; 11,NaN]; 
Each column represent the index that I have to feed in a specific table to return a given row. The problem is: how to get rid of NaN values in a given column?
Unfortunately, it is important to know in which column the index is because each column of the array is linked to a specific table.
Ex. 
The index 11 in column 1  makes me select row 11 of table 1 while the same index in column 2  makes me select row 11 of table 2.  Moreover since everything is parametric I cannot divide my 3x2 in two column arrays. 
I need inside this recalling a procedure to neglect NaN values: 
A{1,1}{a(:,1),8};
Otherwise, I have the error because array indices must be positive values. 
Thanks to you all in advance!!:)
0 comentarios
Respuesta aceptada
  dpb
      
      
 el 1 de Oct. de 2021
        
      Editada: dpb
      
      
 el 1 de Oct. de 2021
  
      >> a=[NaN,NaN; NaN,2; 11,NaN]; 
>> a
a =
           NaN           NaN
           NaN          2.00
         11.00           NaN
>> [r,c]=find(isfinite(a))
r =
          3.00
          2.00
c =
          1.00
          2.00
>>
A sample use to find values in an auxiliary array B of size at least 11x2 --
V=arrayfun(@(i,j) B(i,j),r,c)
Salt to suit your specific addressing syntax.
0 comentarios
Más respuestas (0)
Ver también
Categorías
				Más información sobre Numeric Types 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!

