# How to loop until a button is pushed in MATLAB 8

Posted by **Doug Hull**,

**Category:**- Format: Video,
- Level: Basic,
- Topic: GUI or GUIDE

## 8 CommentsOldest to Newest

**1**of 8

**2**of 8

**3**of 8

**4**of 8

**all the steps give the expected answer which are 1*100 matrices. but suddenly at the matrix part (A&B) I just get a 2*2 for A and a 2*1 for B meaning the loop only evaluates the 100th number of miu and other variables, but I have different values of miu(i)[1*100 matrix] ?! what is the problem here? or is it a problem?! I dont know if the explanations are enough for you to understand the problem, if needed I'll describe more. regards,**

Sorry it seems that the program wasn't sent
here it is:
dhull
replied on
@Ali,
https://blogs.mathworks.com/pick/2007/08/20/matlab-basics-video/
I think this is what you are looking for. :
Kent
replied on
Fantastic! Your comment at the end was exactly what I was looking for - to have separate start and cancel push buttons. Thank-you! :
tarun siingh
replied on
I want to make a physical pushbutton on bread board by connecting with Arduino and interface this pushbutton to the Gui virtual pushbutton to call-back when I push the physical one. please, provide me coding help to do this task. :

%Initial Data rho=1.225; % Air density at 20 degrees Celcius(kg/m^3) R=7.5; % Main blade radius(m) N=4; % Number of blades W=7400; % Gross weight(Kg) omega=265*2*pi/60; % main blade rotation(rad/sec) Cl=5.73; % NACA 0012 lift-alpha coefficient(1/rad) Aeq=16*(0.3048^2); % Equivalent Area(m^2) v=linspace(0,73,100); % speed of Helicopter(m/sec) sig=N/(omega*R); % Solidity for i=1:100 Dfus(i)=rho*(v(i)^2)*Aeq/2; alphad(i)=Dfus(i)/W; T(i)=sqrt(W^2+Dfus(i)^2); CT(i)=T(i)/(rho*pi*(omega^2)*(R^4)); miu(i)=v(i)./(omega*R); % calculating labda using the graph of vbar_i vs. vbar vbar(i)=miu(i)./sqrt(CT(i)./2); if vbar(i)<=2 vbar_i(i)=sqrt(-(vbar(i)^2/2)+sqrt((vbar(i)^4/4)+1)); else vbar_i(i)=1/vbar(i); end % plot(vbar,vbar_i) % Matrices to solve theta0 and thetaC labda(i)=vbar_i(i)./(omega*R); A=[2/3+miu(i)^2 -miu(i);(8/3)*miu(i) -(1+((3/2)*(miu(i)^2)))]; B=[(4*CT(i))./(Cl*sig)+labda(i)+(miu(i)*alphad(i));2*miu(i)*(labda(i)+miu(i)*alphad(i))]; theta(:,i)=A\B; end theta0=theta(1,i); % Collective pitch thetaC=theta(2,i); % Cyclic pitch plot(v,theta0,'g') hold on plot(v,thetaC,'r')

**6**of 8

**7**of 8

**8**of 8

## Recent Comments