MATLAB: App Designer and external function

app designerguimatlab functionmatlab guimatrix

Im having issues with running my app. The m file alone works but, when I attempt to convert it to the app, its throwing errors just in the app. My code involves matrixes and vectors. Error is at the external function ElementofFasteners, I have commented the lines for a visual representation of what I am seeing. Like I said, this works as a standalone m. file without the app. What am I missing and are the app.inputs creating different variables or… need a bit of help
Error using /
Matrix dimensions must agree.
Error in Fasteners (line 29)
c1=(((t1 + t2)/(2*D))^a);
% Button pushed function: SolveButton
function SolveButtonPushed(app, event)
%Solve Everything here
app.FastF1.Value = numfast(app.nf); % numfast external function-works
app.FastF2.Value = app.E1;
app.FastF3.Value = app.d3;
app.nnel = 3 * app.nf;
app.nnode = 2 + (2 * app.nf);
app.sdof = app.nnode * app.ndof;
kk=zeros(app.sdof,app.sdof);
index=zeros(app.nel*app.ndof,1); %orange underline (use Plate(app.,..
for iel=1:app.nnel
if iel <= (app.nnel - app.nf)
[k]=Plate(app.E1,app.w,app.t1,app.L); % Plate external function-orange underline (use Plate(app.,..
index = ElementdofPlate(iel,app.nel,app.ndof,app.nf);
else
if app.count == 1
d = app.d2;
app.count = app.count + 1;
elseif app.count == 2
d = app.d3;
app.count = app.count + 1;
elseif app.count == 3
d = app.d4;
app.count = app.count + 1;
elseif app.count == 3
d = app.d5;
app.count = app.count + 1;
elseif app.count == 4
d = app.d6;
app.count = app.count + 1;
else
d = app.d1;
app.count = app.count + 1;
end
[k]=Fasteners(app.E1,app.E2,app.E3,app.t1,app.t2,d); % Fastners external function-orange underline (use Fasteners(app.,..
index = ElementdofFasteners(iel,app.nf); % external function-orange underline (use Elemt..(app.,..



end
kk=Assemble(kk,k,index); % external function-orange underline (use Elemt..(app.,..
end
%
% Applying the Boundary conditions
[kk] = constraints(kk,1) ;% external function-orange underline (use Elemt..(app.,..
[kk] = KRED(kk,app.nnode);% external function-orange underline (use Elemt..(app.,..
[uu] = Displacements(kk,app.P,app.nnode); % external function-orange underline (use Elemt..(app.,..
app.FastF4.Value = uu(1);

Best Answer

Check the order of the callbacks