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
Best Answer