clear
clc
format compact
mysol(3) = struct('name','bleach','pH',12);
mysol(1) = struct('name','juce','pH',5);
mysol(2) = struct('name','milk','pH',7);
acidity = myacidity(mysol);
for i = 1:3
mysol(i).acidity = strcat(acidity(i,:));
end
mysol
mysol.acidity
function acidity = myacidity(mysol)
len = length(mysol);
acidity(len,:) = blanks(7);
for i = 1:len
if mysol(i).pH < 7
acidity(i,:) = 'acidic ';
elseif mysol(i).pH > 7
acidity(i,:) = 'basic ';
else
acidity(i,:) = 'neutral';
end
end
end
3 Comments
Direct link to this comment
https://nl.mathworks.com/matlabcentral/answers/23591-how-do-i-combine-multiple-plots-in-one-graph#comment_433968
Direct link to this comment
https://nl.mathworks.com/matlabcentral/answers/23591-how-do-i-combine-multiple-plots-in-one-graph#comment_433968
Direct link to this comment
https://nl.mathworks.com/matlabcentral/answers/23591-how-do-i-combine-multiple-plots-in-one-graph#comment_593667
Direct link to this comment
https://nl.mathworks.com/matlabcentral/answers/23591-how-do-i-combine-multiple-plots-in-one-graph#comment_593667
Direct link to this comment
https://nl.mathworks.com/matlabcentral/answers/23591-how-do-i-combine-multiple-plots-in-one-graph#comment_1160058
Direct link to this comment
https://nl.mathworks.com/matlabcentral/answers/23591-how-do-i-combine-multiple-plots-in-one-graph#comment_1160058
Sign in to comment.