Matlab调用IE并根据录入内容然后搜索
发布网友
发布时间:2022-08-09 07:39
我来回答
共3个回答
热心网友
时间:2024-12-11 19:23
function RandDisplayJiong
axis off; %隐去坐标轴
set(gcf,'menubar','none','toolbar','none');%不显示当前figure 菜单栏和工具栏
for k = 1:100 %循环100次
%每次在(rand,rand)这个随机的位置,以20到50之间随机分布的一个数为字体大小,隶书的形式,
%随机生成RGB颜色,并随机旋转一定角度来显示“囧”
h = text(rand,rand,...
['\fontsize{',num2str(unifrnd(20,50)),'}\fontname {隶书} 囧'],...
'color',rand(1,3),'Rotation',360*rand);
pause(0.2); %每显示完一次暂停0.2秒
end
function T = cat_in_holl(n)
T = zeros(1,n);
for k = 1:n
c = unidrnd(3,1);
while c ~= 1
if c == 2
T(k) = T(k)+4;
else
T(k) = T(k)+6;
end
c = unidrnd(3,1);
end
T(k) = T(k)+2;
end
function example2_3_6slow
A = unidrnd(100,1000000,7);%随机生成1000000*7的A矩阵,A的元素属于1到100的整数
B = zeros(1000000,3);
for m = 1:1000000
a = A(m,:);
b = [4 6 8];
for ii = 1:3
dd = a(a==b(ii));%dd:a中等于b(ii)的元素
if isempty(dd)==0 %dd不为空
b(ii)=0;
end
end
B(m,:)=b;
end
function [m,n,TT]=plot3dnmT(N,L)
%N:inf的近似,L:[0,2]区间的剖分个数
C=zeros(N,1);%nested-function:Tmn=calcT(mm,nn)中用来存储计算结果
m=linspace(0,2,L);
[m,n]=meshgrid(m,m);
TT=zeros(size(n));%和网格数据m,n对应的计算出来的T(m,n)网格数据
for ii=1:L
for jj=1:L
TT(ii,jj)=calcT(m(ii,jj),n(ii,jj));
end
end
%=====计算T(m,n)的nest-function
function Tmn=calcT(mm,nn)
for N1=1:N
C(N1)=(mm^N1/gamma(N1+1))*sum( nn.^(0:N1-1)./gamma(1:N1) );
Tmn=1.0-exp(-mm-nn)*sum(C);
end
end
mesh(n,m,TT);
end
function [mx,minf]=randwalk(f,x,lamda,epsilon,N)
%随机行走法求函数的极小值。输入f为所求函数的句柄,
%x为初始值。lamda为步长。epsilon为控制lamda的减小的阈值,即lamda减小到epsilon时
%迭代停止。
%N为为了产生较好点的迭代控制次数。
%函数返回值mx为n次试验得到的最优解,minf为响应的最优值。
f1 = f(x(1),x(2));
while(lamda>=epsilon)
k = 1;
while(k<=N)
u = unifrnd(-1,1,1,2);
x1 = x+lamda*(u/norm(u));
f11 = f(x1(1),x1(2));
if f11<f1
f1 = f11;
x = x1;
k = 1;
else
k = k+1;
end
end
lamda = lamda/2;
end
mx = x1;
minf = f1;
function triangle_table
fig = figure('defaultuicontrolunits','normalized','name','triangle_table',...
'numbertitle','off','menubar','none');
ah = axes('Pos',[.1 .2 .75 .75],'Visible','off');
slider_h = uicontrol('style','slider','units','normalized','pos',...
[0.1,0.05,0.75,0.05],'sliderstep',[1/6,0.05],'callback',@change_color);
hold on
for k = 0:6
plot(0:6-k,(6-k)*ones(1,(7-k)),'k');
plot(k*ones(1,(7-k)),k:6,'k');
end
plot([0,6],[0,6],'k');
hold off;
for x = 1:5
for y = 1:x
text(y-0.5,x+0.5,num2str(x),'color','k','tag','数字');
end
end
for k = 0:5
text(k+0.1,k+0.5,[num2str(k),'.5'],'tag','数字');
end
%====slider's callback function(nested function)======
function change_color(hObject,eventdata)
v = round(6*get(slider_h,'value'));
num_h = findobj('tag','数字');
num_pos = get(num_h,'pos');
red_num_logic = cellfun(@(x) (x(1)<=v&&x(2)<=v),num_pos);
set(num_h(red_num_logic),'color','r');
set(num_h(~red_num_logic),'color','k');
end
end
function DuckLakeSegmentation
%导入图像文件引导对话框
[filename,pathname,flag] = uigetfile('*.jpg','请导入图像文件');
Duck = imread([pathname,filename]);
LakeTrainData = [52 74 87;76 117 150;19 48 62;35 64 82;46 58 36;...
50 57 23;110 127 135;156 173 189;246 242 232;...
166 174 151];%从图上选取的几个位于湖面区域的有代表的点的RGB值
%从图上选取的几个位于鸭子区域的有代表的点的RGB值
DuckTrainData = [211 192 107;202 193 164;32 25 0;213 201 151;115 75 16;...
101 70 0;169 131 22;150 133 87];
%属于湖的点为0,鸭子为1
group = [zeros(size(LakeTrainData,1),1);ones(size(DuckTrainData,1),1)];
LakeDuckSVM = svmtrain([LakeTrainData;DuckTrainData],group,...
'Kernel_Function','polynomial','Polyorder',2);%训练得到支持向量分类机
[m,n,k] = size(Duck);
Duck1 = double(reshape(Duck, m*n, k));%将数组Duck转成m*n行,3列的双精度矩阵
%根据训练得到的支持向量机对整个图像的像素点分类
IndDuck = svmclassify(LakeDuckSVM,Duck1);
IndLake = ~IndDuck;%属于湖的点的逻辑数组
result = reshape([IndLake, IndLake, IndLake],[m,n,k]);%和图片的维数相对应
Duck2 = Duck;
Duck2(result) = 0;
figure
imshow(Duck2)
function example12_1_3
%定时器的TimerFun,供TimerA,TimerB,TimerC共用
function TimerFun(object,event)
t = clock; %函数刚开始执行时间点
pause(1);%函数执行了1秒钟
et = etime(t,get(object,'userdata'));%函数开始运行和上次函数开始运行时间间隔
disp(['本次函数开始执行距上次函数开始执行时间为:',num2str(et),' S!'])
set(object,'userdata',t);%记录本次函数开始运行时间
end
%定义定时器TimerA, 'executionmode'设为'fixedSpacing'
TimerA = timer('StartFcn','disp(''定时器A开始:'')','ErrorFcn',...
'disp(''A发生错误'')','StartDelay',0.5,'TimerFcn',@TimerFun,'stopfcn',...
'disp(''定时器A停止!'')','executionmode','fixedSpacing','period',0.5,...
'TasksToExecute',3);
%定义定时器TimerB, 'executionmode'设为'fixedDelay'
TimerB = timer('StartFcn','disp(''定时器B开始:'')','ErrorFcn',...
'disp(''B发生错误'')','StartDelay',0.5,'TimerFcn',@TimerFun,'stopfcn',...
'disp(''定时器B停止!'')','executionmode','fixedDelay','period',0.5,...
'TasksToExecute',3);
%定义定时器TimerC, 'executionmode'设为'fixedRate'
TimerC = timer('StartFcn','disp(''定时器C开始:'')','ErrorFcn',...
'disp(''C发生错误'')','StartDelay',0.5,'TimerFcn',@TimerFun,'stopfcn',...
'disp(''定时器C停止!'')','executionmode','fixedRate','period',0.5,...
'TasksToExecute',3);
%运行定时器A
set(TimerA,'userdata',clock);
start(TimerA);
wait(TimerA);
%运行定时器B
set(TimerB,'userdata',clock);
start(TimerB);
wait(TimerB);
%运行定时器C
set(TimerC,'userdata',clock);
start(TimerC);
wait(TimerC);
end
热心网友
时间:2024-12-11 19:23
function [mx,minf]=randwalknew(f,x,lamda,epsilon,N,n)
F=zeros(n,1);
X=zeros(n,2);
f1=f(x(1),x(2));
while(lamda>=epsilon)
k=1;
while(k<=N)
u=unifrnd(-1,1,n,2);
for ii=1:n
X(ii,:)=x+lamda*(u(ii,:)/norm(u(ii,:)));
F(ii)=f(X(ii,1),X(ii,2));
end
[f11,kk]=min(F);
if f11<f1
f1=f11;
x=X(kk,:);
k=1;
else
k=k+1;
end
end
lamda=lamda/2;
end
mx=X(kk,:);
minf=f1;
》f2=@(x,y)-sin(sqrt((x-50).^2+(y-50).^2)+exp(1))./(sqrt((x-50).^2+(y-50).^2)+exp(1))-1;
》 [mx,minf]=randwalknew(f2,[0,0],10,0.00001,1000,10)
热心网友
时间:2024-12-11 19:24
clc
clear
ie=actxserver('internetexplorer.application');
ie.Navigate('www.swjtu.e.cn');%输入网址
会的就这么多啊,可以先运行试试追问谢谢您!打开网站的方法,我也在论坛上了解到了。如果用dos函数,可能更直接一些。不过还是谢谢你的解答啦!哈哈