フィルターのクリア

I'm trying to run this script in matlab mobile but giving me an error

4 ビュー (過去 30 日間)
Hussein
Hussein 2023 年 12 月 29 日
編集済み: Cris LaPierre 2023 年 12 月 30 日
Name : persuite_curve_3d.m
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
close all;
clear;
clc;
GUI = {'Projectile Speed[m/s]: ' , 'Simulation Time[s]: ','Start Position [X;Y]: ','Impact Radius[m]','Time Step: '};
D_ans = {'750','30','[1500;1500]','25','0.02'};
Title = '3D Pursuit Curve';
dims = [1 50];
input = inputdlg(GUI,Title,dims,D_ans);
w = str2double(input{1});
xf = str2double(input{2});
pos = str2num(char(input{3}));
radius = str2num(input{4});
h = str2double(input{5});
Movement = questdlg('Please Select The Movement Type : ','3D Pursuit Curve','Straight Line','Circular Motion','Custom Function','Straight Line');
switch Movement
case 'Straight Line'
GUI = {'Target Speed[X,Y,Z]: ','Start Position [X;Y;Z]: '};
D_ans= {'[300,300,300]','[-2900;-2700;-2500]'};
Title = 'Straight Line';
input = inputdlg(GUI,Title,dims,D_ans);
v = str2num(char(input{1}));
Tpos = str2num(char(input{2}));
T = @(t) [v(1)*t;...
v(2)*t;...
v(3)*t] + [Tpos(1);Tpos(2);Tpos(3)];
case 'Circular Motion'
GUI = {'Target Speed[m/s]: ','Raduis[m]: ','Frequency[hz]','Angular Velocity[\fontsize{15}\omega\fontsize{8}]','Start Position [X;Y;Z]: '};
D_ans= {'250','400','0.8','0.7','[-2500;-2500;-2500]'};
Title = 'Straight Line';
opts.Interpreter = 'tex';
input = inputdlg(GUI,Title,dims,D_ans,opts);
Tpos = str2num(char(input{5}));
T = @(t) roty(45)*rotx(-45)*[str2double(input{2}) * cos(str2double(input{3})*pi*str2double(input{4}) * t);...
str2double(input{2}) * sin(str2double(input{3})*pi*str2double(input{4}) * t);...
str2double(input{1}) * t] + [Tpos(1);Tpos(2);Tpos(3)];
end
dpdt = @(t,p) (w*((T(t) - p)/(norm(T(t)-p))));
pos = [pos(1);pos(2);-0];
[ t , p ] = ode4( dpdt , [0 xf] , pos , h );
Target = T(t(1));
figure('Units','normalized','Position',[0 0 1 1])
hold on
axis([-1 1 -1 1 -1 1] * 3000)
img = imread('sky.jpg');
xImage = [-3000 3000; -3000 3000];
yImage = [+3000 +3000; +3000 +3000];
zImage = [3000 3000; -3000 -3000];
surf(xImage,yImage,zImage,...
'CData',img,...
'FaceColor','texturemap');
xImage = [-3000 -3000; -3000 -3000];
yImage = [+3000 -3000; +3000 -3000];
zImage = [3000 3000; -3000 -3000];
surf(xImage,yImage,zImage,...
'CData',img,...
'FaceColor','texturemap');
img = imread('field.jpeg');
xImage = [-3000 3000; -3000 3000];
yImage = [+3000 +3000; -3000 -3000];
zImage = [-3000 -3000; -3000 -3000];
surf(xImage,yImage,zImage,...
'CData',img,...
'FaceColor','texturemap');
z = plot3(p(1,1),p(2,1),p(1,3),'bo',Target(1,1),Target(2,1),Target(3,1),'ro',p(1),p(2),p(3),'bs');
set(z(1),'MarkerSize',4,'MarkerFaceColor','k','MarkerEdgeColor','b');
set(z(2),'MarkerSize',7,'MarkerFaceColor','r','MarkerEdgeColor','k');
set(z(3),'MarkerSize',15,'MarkerFaceColor','b','MarkerEdgeColor','k');
xlabel('X-AXIS','Editing','off');
ylabel('Y-AXIS','Editing','off');
zlabel('Z-AXIS','Editing','off');
legend('','','','Projectile','Target','Launch Site','');
grid on;
hold off
view(45,45);
curve = animatedline(Target(1),Target(2),Target(3),"Color",'r');
impact = 0;
X = 0;
Y = 0;
Z=0;
for i=1:length(t)
Target = T(t(i));
set(z(1),'XData',p(1,i),'YData',p(2,i),'ZData',p(3,i));
set(z(2),'XData',Target(1),'YData',Target(2),'ZData',Target(3));
addpoints(curve,Target(1),Target(2),Target(3));
drawnow;
if (norm(p(:,i)-Target) <= radius)
impact = 1;
X = p(1,i);
Y = p(2,i);
Z = p(3,i);
break;
end
end
if(impact == 1)
set(z(2),'MarkerSize',15,'MarkerFaceColor','y','MarkerEdgeColor','r','Marker','p','LineWidth',1.75)
set(z(1),'MarkerSize',10,'MarkerFaceColor','y','MarkerEdgeColor','r','Marker','h','LineWidth',1.8)
d = dialog('Position',[800 300 350 150],'Name','Collision Information');
txt1 = uicontrol('Parent',d,...
'Style','text',...
'Position',[40 70 250 30],...
'String',['Collision Position(x,y) : ' ,'(',num2str(sprintf('%.f',X)),';',num2str(sprintf('%.f',Y)),';',num2str(sprintf('%.f',Z)),')'],...
'FontSize',10,...
'Units', 'normalized');
txt2 = uicontrol('Parent',d,...
'Style','text',...
'Position',[40 110 200 15],...
'String',['Collision Time(seconds) : ','(',num2str(t(i)),')'],...
'FontSize',10,...
'Units','normalized');
btn = uicontrol('Parent',d,...
'Position',[140 20 70 25],...
'String','Close',...
'Callback','delete(gcf)');
else
d = dialog('Position',[800 300 350 150],'Name','Collision Information');
txt1 = uicontrol('Parent',d,...
'Style','text',...
'Position',[40 70 250 30],...
'String',("The Projectile didn't hit the target in the simulation time"),...
'FontSize',10,...
'Units', 'normalized');
end
figure('Units','normalized','Position',[0 0 1 1])
subplot(1,2,1);
axis([-1 1 -1 1]*3000)
plot3(p(1,1:i),p(2,1:i),p(3,1:i),'b');
title('Projectile movment');
xlabel('X-AXIS','Editing','off');
ylabel('Y-AXIS','Editing','off');
zlabel('Z-AXIS','Editing','off');
grid on;
target2 = T(t(1:i));
subplot(1,2,2)
plot3(target2(1,:),target2(2,:),target2(3,:),'r')
title('Target movment')
xlabel('X-AXIS','Editing','off');
ylabel('Y-AXIS','Editing','off');
zlabel('Z-AXIS','Editing','off');
grid on;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
the error:
Unable to run the 'persuit_curve_3d'
function, because it is not supported
for MATLAB Mobile.
Caused by:
Error using
matlab.internal.lang.capability.Capability.require
Support for Java user interfaces
is required, which is not available
on this platform.
  9 件のコメント
Steven Lord
Steven Lord 2023 年 12 月 29 日
Run this code one line at a time and tell us exactly which line causes the error to be thrown.
I suspect Walter Roberson is correct, that trying to open up a dialog window in a mobile application using inputdlg is not going to work.
Hussein
Hussein 2023 年 12 月 29 日
the error happens in the inputdlg and questdlg

サインインしてコメントする。

回答 (1 件)

Cris LaPierre
Cris LaPierre 2023 年 12 月 29 日
編集済み: Cris LaPierre 2023 年 12 月 30 日
MATLAB Mobile does not support Java user interfaces (your inputdlg's and questdlg's).

カテゴリ

Help Center および File ExchangeInteractive Control and Callbacks についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by