range isn't working
    11 visualizzazioni (ultimi 30 giorni)
  
       Mostra commenti meno recenti
    
    Evgeny Hahamovich
 il 30 Ott 2021
  
    
    
    
    
    Risposto: Evgeny Hahamovich
 il 30 Ott 2021
            Just got the R2021b version and some of my code isn't working :(
The basic function "range" initialy offered me to calculate some wave propogation parameters, I solved this by removing the Communications Toolbox, but now it's not working at all!
Here is an example of the error:
a=[1 2 3]
>> range(a)
'range' requires one of the following:
  Antenna Toolbox
  Communications Toolbox
  Fixed-Point Designer
  Statistics and Machine Learning Toolbox
>> range(a,'all')
'range' requires one of the following:
  Antenna Toolbox
  Communications Toolbox
  Fixed-Point Designer
  Statistics and Machine Learning Toolbox
Very frustrating
0 Commenti
Risposta accettata
  Chris
      
 il 30 Ott 2021
        Yep, I don't think it's part of base Matlab. It works as you would expect if you install the Statistics and Machine Learning Toolbox.
1 Commento
  Chris
      
 il 30 Ott 2021
				
      Modificato: Chris
      
 il 30 Ott 2021
  
			You could write your own range function and put it somewhere in your matlab path, if you don't want to install the toolbox. As a simple example, if you only need it to work with vectors:
function y = range(X)
    % prevent some invalid inputs
    arguments 
        X (:,1) {mustBeNumeric, mustBeReal}
    end
    y = max(X)-min(X);
end
(the full function from the toolbox is not much more complicated, but I'm not sure about the legality of posting it here)
Più risposte (3)
  Image Analyst
      
      
 il 30 Ott 2021
        What about the built-in bounds() function:
v = 4:99;
[minv, maxv] = bounds(v)
minv =
     4
maxv =
    99
0 Commenti
Vedere anche
Categorie
				Scopri di più su Cloud Integrations in Help Center e File Exchange
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!



