Hello,
This is my first time using this forum, so I though it would be great to ask the community to help me with a homework problem I have to do. The question I have is how can I use an If and Else statement to see if a value I have in a matrix is within a matrix? I attached a picture of the homework problem if you want clarity of what I had to do
. I did the code for the problem, but I'm getting errors when doing it.
Any help with be appreciable.
Here's the code I have so far:
parttolerance = [23.45 27.89 44.203 9.8 10.3];save parttol.dat parttolerance -asciipartweight = input('Please enter the weight of a part: ');PartWeight = tolerance(partweight);disp(PartWeight);function PartWeight = tolerance(partweight)if partweight == parttolerance(:) PartWeight= 'The weight you entered is within the range'; else PartWeight = 'The weight you entered is not within the range';endend%{
Here's the error I get from the code once I run itError in parttol>tolerance (line 11)if partweight == parttolerance(:)Error in parttol (line 6)PartWeight = tolerance(partweight);%}
Best Answer