App Designer "Strategy" error

4 views (last 30 days)
Ra Karamislo
Ra Karamislo on 5 Feb 2019
Hello
I am having a problem with app designer. I have marked the error place which matlab indicates. its at the end. %%Errror%%
It looks like it does not like data type that is passes into the table, but same code in script returns double and it should be fine. But it is not.
I would like to trace my variables value in app designer but i could not find how.
I have attached part of the code from app designer and error messages.
Could anybody pleaase help me?
Thank you
% Button pushed function: VerifyButton
function VerifyButtonPushed(app, event)
app.VerifyButton.Enable = 'off';
value=app.Current_Traj_Name;
x = sym('x'); % Declare symbolic variable
t = sym('t');
k = sym('k');
switch value
case 'Archimedean'
n = app.Radius.Value/app.Step.Value; % Calculates number of revolutions around origin the trajectory is going to make
f = @(x)app.Radius.Value*(1-x./(2*pi*n));
case 'Oval'
f = @(x)(app.Step.Value/(4*pi))*(x.*((cos(x+pi/2)).^2)+x);
case 'Four Petal'
f = @(x)x.*(app.Step.Value/(pi)).*(cos(x).*sin(x));
case 'Three Petal'
f = @(x)x.*(app.Step.Value/(2*pi)).*((cos(x+x/2)).^2);
case 'Infinity'
f = @(x) x.*(app.Step.Value/(2*pi)).*((cos(x+pi/2)).^2);
case 'Circular'
f = @(x)app.Radius.Value;
otherwise
end
if strcmpi(app.Switch.Value,'UAV') % Check what option UAV control user choosed
theor_length_interval = app.VelocityEditField.Value*app.TimeEditField.Value; % Calculation required interval length to mark for all curves
np=uint8(fix(app.Traj_theor_len/theor_length_interval)+1); % setting number of transmission points
else
theor_length_interval = app.Traj_theor_len/(app.NumberofpointsEditField.Value-1); % calculating the interval of transmission points
np=uint8(app.NumberofpointsEditField.Value);
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%
drfordx = diff(f,x); % differentiating trajectory curve polar function with respect to theta
lengths=(0:theor_length_interval:app.Traj_theor_len)'; % creating an array of intervals with increasng lengths
[th,~]=cart2pol(real(app.Trans_points_prac),imag(app.Trans_points_prac)); % getting the starting point for numrical evaluation
% practically calculated transs points are used as a guess to start
% theretical evaluating, using the practical points as center of
% evaluation.
% start timer to check the time for all trans points evaluation
%x0=double(0.9.*th);
sample_length=vpaintegral(sqrt((f(x))^2+drfordx^2),x,0,t); % Finding an equation curve length of angle t
if np>12
nw=12;
else
nw=uint8(np);
end
%nw=12;
wb=waitbar(0.01,'Starting parallel pool...');
delete(gcp('nocreate'));
myCluster=parcluster('local');
myCluster.NumWorkers=nw;
parpool(myCluster,nw)
mypool = gcp();
fprintf('Started solving vpa \n');
for i=1:np
equation = @(k) double(vpasolve( sample_length == k, t));
parRes(i) = parfeval(mypool,equation,1,lengths(i));
end
TimeOut=30*np;
%delete(wb);
fr=uint8(TimeOut/100);
%waitbar(0.01,'Computing');
for j=1:98
waitbar(j/100,wb,['Completed ',num2str(j),' %' ]);
pause(fr);
end
pause(2);
%delete(wb);
fprintf('Started evaluating fsolve \n');
for i=1:np
if ~strcmpi(parRes(:,i).State, 'finished')
equation = @(t) double(vpaintegral(sqrt((f(x))^2+drfordx^2),x,0,t)-lengths(i));% Finding an equation for arc length with respect of angle t
parFun = @(k) fsolve(equation,k, optimoptions('fsolve','Display','off','FiniteDifferenceType','central')); % solve the equation for angle t, knowing length.
x0=double(th(i));
parRes(i) = parfeval(mypool,parFun,1,x0);
end
end
waitbar(j/100, wb,'Evaluating numerically');
pause(2);
magicResults = cell(np,1);
for i = 1:np
try
[completedIdx,value] = fetchNext(parRes);
magicResults{completedIdx} = value;
waitbar(j/100, wb,['Obtaining point ', num2str(completedIdx)]);
catch e
fprintf(1,'The identifier was:\n%s',e.identifier);
fprintf(1,'There was an error! The message was:\n%s \n',e.message);
waitbar(1, wb, ['Error:\n%s \n',e.message]);
end
end
pause(2);
%waitbar(1, wb, 'Closing parallel pool');
%waitbar(1, wb, 'Closing parallel pool');
%fprintf('Finished solving vpa \n');
%delete(gcp('nocreate'));
cancel(parRes);
clear parRes;
clear mypool;
delete(wb);
phi = zeros(np,1);
for i=1:np
if numel(magicResults{i})==0
phi(i)=NaN;
else
phi(i)=magicResults{i}(1);
end
end
rho=f(phi); % find corresponding
[theor_x,theor_y] = pol2cart(phi,rho); % transform polar coordinates to complex
%theor_p=theor_x+1i*theor_y; % [theor_x, real(p), theor_y, imag(p)]
% stop timer for all the trans points
%[theor_x,theor_y] = pol2cart(phi1,rho1); % transform polar coordinates to complex
app.Theor_trans_points =[theor_x, theor_y];
points_diff=app.Theor_trans_points-[real(app.Trans_points_prac), imag(app.Trans_points_prac)];
discreps=(points_diff(:,1)).^2+(points_diff(:,2)).^2;
max_disc=max(discreps);
app.ErrorEditField_2.Value=max_disc;
if strcmpi(app.Switch.Value,'UAV')
time = app.TimeEditField.Value * (0:numel(theor_x)-1);
app.UITable2.ColumnName = {'Time','X','Y'};
app.UITable2.Data = [time',theor_x,theor_y]; %%%%Error shows here%%%%
else
point_number=(1:np)';
app.UITable2.ColumnName = {'Point Number','X','Y'};
app.UITable2.Data = [point_number,theor_x,theor_y]; %%%%%% And also herte %%%%
end
clf;
h=figure(1);
movegui(h,[0+650,220]);
plot(app.Z_curve_coords,'Color', [0 0.4470 0.7410], 'clipping', 'off');
axis equal;
hold on;
plot(real(app.Trans_points_prac), imag(app.Trans_points_prac),'r*');
hold on
plot(theor_x,theor_y,'k+');
app.Label_2.Text=app.Current_Traj_Name;
app.SavetableButton_2.Enable='on';
end
Output argument "strategy" (and maybe others) not assigned during call to "matlab.ui.internal.controller.uitable.VariableEditorView/createViewStrategy".
Error in matlab.ui.internal.controller.uitable.VariableEditorView/setData (line 100)
this.viewStrategy = this.createViewStrategy();
Error in matlab.ui.internal.controller.uitable.WebTableController/updateData (line 161)
this.view.setData(this.Model.Data);
Error in matlab.ui.internal.componentframework.WebComponentController>@(varargin)obj.updateData(varargin{:})
Error in matlab.ui.internal.componentframework.WebComponentController/triggerUpdateOnDependentViewProperty (line 145)
value = feval( eval( [ '@obj.update' property ] ) );
Error in matlab.ui.internal.componentframework.WebComponentController/setProperty (line 173)
obj.triggerUpdateOnDependentViewProperty( dependentProperties{idx} );
Dot indexing is not supported for variables of this type.
Error in matlab.ui.internal.controller.uitable.VariableEditorView/setData (line 99)
if ~ismember(class(value), this.viewStrategy.dataTypes)
Error in matlab.ui.internal.controller.uitable.WebTableController/updateData (line 161)
this.view.setData(this.Model.Data);
Error in matlab.ui.internal.componentframework.WebComponentController>@(varargin)obj.updateData(varargin{:})
Error in matlab.ui.internal.componentframework.WebComponentController/triggerUpdateOnDependentViewProperty (line 145)
value = feval( eval( [ '@obj.update' property ] ) );
Error in matlab.ui.internal.componentframework.WebComponentController/setProperty (line 173)
obj.triggerUpdateOnDependentViewProperty( dependentProperties{idx} );

Answers (0)

Categories

Find more on Develop Apps Using App Designer in Help Center and File Exchange

Products


Release

R2018b

Community Treasure Hunt

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

Start Hunting!