question on use of Tilde
    6 visualizaciones (últimos 30 días)
  
       Mostrar comentarios más antiguos
    
Hi
I was looking at on of the sample code in matlab webinars, I could not understand the use of ~ in the code below , as I understand that ~ (not) is a logical operator.
% Perform a parameter sweep to identify the best setting.
sh = nan(100,1);
for m = 2:100
    [~,~,sh(m)] = leadlag(BundClose,1,m);
end
[~,mxInd] = max(sh);
Please help, thanks in advance.
Rgds
0 comentarios
Respuesta aceptada
  Walter Roberson
      
      
 el 7 de Oct. de 2012
        When ~ appears in the left side of an assignment statement with multiple outputs, it means that that particular output should be discarded.
For example,
[~,mxInd] = max(sh);
is the same as
[TEMP,mxInd] = max(sh);
clear TEMP
This syntax has only been part of MATLAB since about R2009b or so.
Más respuestas (0)
Ver también
Categorías
				Más información sobre Get Started with MATLAB 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!

