loop5=0;
while~loop5
parameters=input('Parameters Data( manufacturer or test ) = ','s');
if ~ismember(parameters,{'manufacturer','test'})
loop5 = 0;
else loop5 = 1;
end
end
if parameters == 'test'
disp('Test Data');
Pnl=input ('No load power input= ');
Inl=input ('No load line current= ');
Pbr=input ('Lock rotor power input= ');
Ibr=input ('Lock rotor line current= ');
elseif parameters == 'manufacturer'
disp('Manufacturers data');
R1=input('R1= ');
R2=input('R2= ');
X1=input('X1= ');
X2=input('X2= ');
Rc=input('Rc= ');
Xc=input('Xc= ');
else
end
If I will input manufacturer Matrix dimensions must agree error appear.
Thank you for your help

 採用された回答

Star Strider
Star Strider 2018 年 6 月 3 日

1 投票

I cannot run your code to test this.
Try:
if ~strcmp(parameters,{'manufacturer','test'})

6 件のコメント

Jed Villegas
Jed Villegas 2018 年 6 月 3 日
loop5=0;
while~loop5
parameters=input('Parameters Data( manufacturer or test ) = ','s');
if ~ismember(parameters,{'manufacturer','test'})
loop5 = 0;
else loop5 = 1;
end
end
if parameters == 'test'
disp('Test Data');
Pnl=input ('No load power input= ');
Inl=input ('No load line current= ');
Pbr=input ('Lock rotor power input= ');
Ibr=input ('Lock rotor line current= ');
elseif parameters == 'manufacturer'
disp('Manufacturers data');
R1=input('R1= ');
R2=input('R2= ');
X1=input('X1= ');
X2=input('X2= ');
Rc=input('Rc= ');
Xc=input('Xc= ');
else
end
Jed Villegas
Jed Villegas 2018 年 6 月 3 日
Thats's the program. Thank you for your answer.
Jed Villegas
Jed Villegas 2018 年 6 月 3 日
Still not working for if ~strcmp(parameters,{'manufacturer','test'})
Star Strider
Star Strider 2018 年 6 月 3 日
This runs for me without error:
loop5=0;
while~loop5
parameters=input('Parameters Data( manufacturer or test ) = ','s');
if ~strcmp(parameters,{'manufacturer','test'})
loop5 = 0;
else loop5 = 1;
end
end
if strcmp(parameters ,'test')
disp('Test Data');
Pnl=input ('No load power input= ');
Inl=input ('No load line current= ');
Pbr=input ('Lock rotor power input= ');
Ibr=input ('Lock rotor line current= ');
elseif strcmp(parameters ,'manufacturer')
disp('Manufacturers data');
R1=input('R1= ');
R2=input('R2= ');
X1=input('X1= ');
X2=input('X2= ');
Rc=input('Rc= ');
Xc=input('Xc= ');
else
end
Jed Villegas
Jed Villegas 2018 年 6 月 3 日
Oh. Thank you so much. You're the best!
Star Strider
Star Strider 2018 年 6 月 3 日
As always, my pleasure!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File Exchange で MATLAB についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by