Index in position 1 is invalid. Array indices must be positive integers or logical values. getting this error command while running this code
    3 visualizaciones (últimos 30 días)
  
       Mostrar comentarios más antiguos
    
    JIBIN GEORGE
 el 2 de Feb. de 2022
  
    
    
    
    
    Comentada: JIBIN GEORGE
 el 2 de Feb. de 2022
            old_obs_1 = plot3(Obs5(1,1), Obs5(1,2), Z(round(Obs5(1,2)),round(Obs5(1,1))),'o','MarkerSize',20, 'MarkerFaceColor','r','MarkerEdgeColor', 'k');
Please help
Thanks in advance
2 comentarios
Respuesta aceptada
  Simon Chan
      
 el 2 de Feb. de 2022
        At least the value on Obs5(1,2) is <0.5
Obs5 = [0.5 0.4];
Z=rand(2,3);
old_obs_1 = plot3(Obs5(1,1), Obs5(1,2), Z(round(Obs5(1,2)),round(Obs5(1,1))),'o','MarkerSize',20, 'MarkerFaceColor','r','MarkerEdgeColor', 'k');
Más respuestas (1)
  KSSV
      
      
 el 2 de Feb. de 2022
        This error is simple, you are trying to extract more number of elements than present in the array. 
A = rand ;  % A is aconstat i.e 1x1 array. 
A(1)   % no error 
A(1,2)  % error becasue there is no second element, alse A(2) means the same 
Check your variable dimensions. You have used index 2, it seemsthere is no second element. 
0 comentarios
Ver también
Categorías
				Más información sobre Matrices and Arrays 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!



