Error entering variables as strings
Ältere Kommentare anzeigen
I am having some issues trying to get this code to function properly. It is supposed to help me formulate categorical logic statements quickly. I am assigning the varibles to the strings properly? All varibles should have the string as:
varible = input('Prompt: ', 's')
But I am still getting this error:
"Matrix dimensions must agree"
Here is my code.
%Categorical Syllogisms%
%Enter the categorical syllogism's part in standard form.%
disp('Enter the categorical syllogism parts in standard form.')
disp('Use all lowercase when entering your terms.')
quant = input('Quantifier: ','s');
if isempty(quant)
disp('Error, no quantifier entered.')
end
subject_term = input('Subject Term: ','s');
if isempty(subject_term)
disp('Error, no subject term entered.')
end
copula = input('Copula: ','s');
if isempty(copula)
disp('Error, no copula entered.')
end
predicate = input('Predicate Term: ','s');
if isempty(predicate)
disp('Error, no predicate entered')
end
%Categorical Proposition Type%
if quant == 'all'
if copula == 'are'
disp('Type A statement.')
disp('Quantity/Quality: Universal/Affirmative')
statement = 'A';
else
disp('Invalid copula entered.')
end
if quant == 'no'
if copula == 'are'
disp('Type E statement.')
disp('Quantity/Quality: Universal/Negative')
statement = 'E';
else
disp('Invalid copula entered.')
end
if quant == 'some'
if copula == 'are'
disp('Type I statement.')
disp('Quantity/Quality: Particular/Affirmative')
statement = 'I';
if copula == 'are not'
disp('Type O statement.')
disp('Quantity/Quality: Particular/Negative')
statement = 'O';
else
disp('Invalid copula entered.')
end
end
else
disp('Invalid quantifier entered.')
end
end
end
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu Probability Distributions and Hypothesis Tests finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!