how can i get in place of %d is i values for each iteration of e

5 visualizaciones (últimos 30 días)
num_nod=input('num_nod = ')
for e=1:2*num_nod
force(e,1)=input('applied forces at node %d:',e);
end

Respuesta aceptada

Geoff Hayes
Geoff Hayes el 12 de Jun. de 2018
Ganesh - use sprintf to create your string for the input command
force(e,1) = input(sprintf('applied forces at node %d:',e));
Also, pre-allocate memory to the force array so that it doesn't need to increase size on each iteration of the loop. i.e.
num_nod=input('num_nod = ')
force = zeros(2*num_nod,1);
for e=1:2*num_nod
force(e,1) = input(sprintf('applied forces at node %d:',e));
end

Más respuestas (1)

Ganesh budi
Ganesh budi el 13 de Jun. de 2018
thanks sir

Categorías

Más información sobre Linear Algebra 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!

Translated by