Error when If statement is not true
Afficher commentaires plus anciens
Hello,
I have a user supplying a 'Yes' or 'No' input to a question. I want to use the response to determine if plots are created or not. If I select 'Yes', the code runs fine. However, if I select 'No', I get this error: Error in PostProcessing_filetest (line 118) , if answer == 'Yes'. Why won't Matlab go to the else statement if the if-statement is not true? Can someone help point out my error? Below is a portion of my code. The variables in the if-portion of the code are defined before-hand. Thank you!
....
quest = 'Do you want another set of maps?';
answer = questdlg(quest);
if answer == 'Yes'
strm1a = 'What is the map height (pixels)?';
strm2a = 'What is the map width (pixels)?';
strm3a = 'What is the min Frequency?';
strm4a = 'What is the max Frequency?';
strm5a = 'What is the min x parameter?';
strm6a = 'What is the max x parameter?';
strmat = {strm1a,strm2a,strm3a,strm4a,strm5a,strm6a};
xminstrg = round(min(min(min(xparm))));
xmaxstrg = round(max(max(max(xparm))));
default = {'300','500','0','200','0','1000'};
inputmapa = inputdlg(strmat,'New Map Parameters',[1 50],default);
h = str2double(inputmapa{1});
w = str2double(inputmapa{2});
mapFmin = str2double(inputmapa{3});
mapFmax = str2double(inputmapa{4});
mapxmin = str2double(inputmapa{5});
mapxmax = str2double(inputmapa{6});
i = 1;
for i = 1: numfiles
figure(fignum)
fignum = fignum + 1;
hold on
axis([mapxmin mapxmax mapFmin mapFmax])
himage = imagesc(xparm(:,:,i),Farray,Amp(:,:,i));
colormap;
hAxes = himage.Parent;
ampmax(i) = max(max(Amp(:,:,i)));
hAxes.CLim = [s,ampmax(i)/10];
xlabel(strcat(namexparm,'(', unitsxparm, ')'));
ylabel("Frequency(Hz)");
title(strcat("Waterfall map for: Test ", testname , "-", fn(i)))
colorbar;
truesize([h w]);
hold off
end
else
disp("no more plots");
end
.....
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Graphics Object Properties dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!