Parse error when trying to change a text in app designer

Hi,
In app designer for some specific dropdown value, I want some other text to change. I want them to be differrent than starting values only for a distinct dropdown value so I thought it would be better to use while instead of if. However I am getting parse error at the line where I define the condition. My code is:
methods (Access = private)
function updatePlot(app)
app.CompleteLamp.Color = [0.5 0.5 0.5] ;
while app.TypeDropDown.Value = 'normalnontruncated'
app.HumanCapitalUpperLimitEditFieldLabel.Text='Mean'
app.HumanCapitalUpperLimitEditFieldLabel.Text='Standard Deviation'
end
if app.SigmaSlider.Value>0.99/app.AlphaSlider.Value
app.SigmaSlider.Value=0.99/app.AlphaSlider.Value;
end
if app.AlphaSlider.Value>0.99/app.SigmaSlider.Value
app.AlphaSlider.Value=0.99/app.SigmaSlider.Value;
end
sigma = app.SigmaSlider.Value ;
tau = app.TaxRateSlider.Value ;
alpha = app.AlphaSlider.Value ;
hu=generateH(app);
lenh=length(hu);
[ku,ela]=genInv(app);
pubshare=sum(ku==0)/lenh;
plot(app.PulsePlotUIAxes, hu, ku);
xlabel(app.PulsePlotUIAxes,'Individuals');
ylabel(app.PulsePlotUIAxes,'Investment');
tegzt={sprintf('Investment level alpha=%.2f, sigma=%.2f and TaxRate=%.2f', alpha, sigma, tau)};
title(app.PulsePlotUIAxes,tegzt,'FontSize',14);
app.ps.Value = round(pubshare,3);
app.elas.Value={sprintf('Human capital elasticity is %.2f',ela)};
app.CompleteLamp.Color = [0 1 0] ;
end
end
At the line where I use 'while' I get the error : "Parse error at '=': usage might be invalid MATLAB syntax"
Thank you

 Accepted Answer

Try
while strcmpi(app.TypeDropDown.Value, 'normalnontruncated')
If that doesn't work, like maybe if the .Value property is a number rather than a string, use the number, like
while app.TypeDropDown.Value == 3 % Or whatever number in the drop down list 'normalnontruncated' occurs at.

1 Comment

Please I need your help Image Analyst. I don't know how to contact you and my deadline for my project is drawing nearer. Please can you help me answer this question
I can get the correlation between two images i.e. a template and the bigger one, but I don't know how to confirm if the template really is in the image. I apologize for asking this here but please help. Thanks

Sign in to comment.

More Answers (0)

Categories

Find more on App Building in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!