Add a dynamic amount of symbolic variables into a script
    5 visualizaciones (últimos 30 días)
  
       Mostrar comentarios más antiguos
    
    Connor LeClaire
 el 21 de Oct. de 2021
  
    
    
    
    
    Respondida: Paul
      
      
 el 21 de Oct. de 2021
            I am attempting to add a number of symbolic variables dynamically for a script.
The script will get an input from the user about how many joints they are inputting in for some robotic manipulation calculations. Based on this I would like to insert a number of symbolic variables (equal to the amount specified at the initial input).
Is there a way to do this that isn't creating a bunch of variables in storage like:
syms v1 v2 v3 v4 v5 v6 v7 v8 v9 v9 %...
variables = [v1 v2 v3 v4 v5 v6 v7 v8 v9] %...
numvars = input('How many joints would you like to enter: ');
for i=1:numvars
    %Do something
end
0 comentarios
Respuesta aceptada
Más respuestas (1)
Ver también
Categorías
				Más información sobre Number Theory 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!


