While loop has disagreeing matrix dimensions

1 次查看(过去 30 天)
Problematic code:
inputMaterial=input('Enter Tuning Fork Material:')
materialValidation=0;
InputError=1;
while inputMaterial == 'steel' | inputMaterial == 'Steel'
materialValidation=materialValidation-1;
InputError=0;
fprintf('Choice of material: %d','forkMaterial')
break
end
Output:
inputMaterial =
'aluminum'
Matrix dimensions must agree.
Error in PP_SUM22 (line 4)
while inputMaterial == 'steel' | inputMaterial == 'Steel'

采纳的回答

Matt J
Matt J 2022-8-17
while strcmpi(inputMaterial,'steel')

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Graphics Objects 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by