my inputs length arent matching
Afficher commentaires plus anciens
Hi people,
My program asks for the number of loads (cargas), and then asks for the values of each load(potencia).
My program should only be run if my potencia variable length matches the cargas variable length.
When I run it my potencia length is giving me a bigger number then the number of inputs I enter in command window.
I think that's because of the s specification, but I'm not finding another way to solve it. Could you help me?
carga = input('Insira o número total de cargas:');
cargas= 1:carga;
%Meu input de potência deve pedir a quantidade de cargas
potencia=input('Insira as potências das cargas:', 's');
potencia = [potencia];
% A quantidade de potências deve ser igual a quantidade de cargas
if length(potencia) > length(cargas) | length(potencia) < length(cargas)
fprintf('A quantidade de potências deve ser igual a quantidade de cargas');
end
Réponse acceptée
Plus de réponses (1)
Daniel Ribeiro Gonçalves
le 29 Déc 2019
0 votes
Catégories
En savoir plus sur Spline Postprocessing dans Centre d'aide et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!