简单的matlab运行程序

简单的matlab运行程序,第1张

在Matlab下输入:edit,然后余态将下面两行百分号之间的内容,复制进去,保存

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

function [d,r1]=floyd1(vx,vy)

b=inf

a=[0 2 8 1 b b b b

2 0 6 b 1 b b b

8 6 0 7 5 1 2 b

1 b 7 0 b b 9 b

b 1 5 b 0 3 b 8

b b 1 b 3 0 4 6

b b 2 9 b 4 0 3

b b b b 8 6 3 0 ]

d=a

vx=vx+1

vy=vy+1

global r

r=a

for i=1:8

for j=1:8

d(i,j)=a(i,j)

r(i,j)=j

k=1

end

end

for k=1:8

for i=1:8

for j=1:8

if d(i,k)+d(k,j)<d(i,j)

d(i,j)=d(i,k)+d(k,j)

r(i,j)=k

end

end

end

end

r1=r-1

fun3(vx,vy)

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

在Matlab下输入:edit,然后将下面两行百分号告团之间的内容,复制进去,保存

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

function fun3(vx,vy)

global r

t=r(vx,vy)

if vy==t

return

else

fun3(vx,t)

disp(t-1)

fun3(t,vy)

end

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

返回matlab 输入:

[d,r1]=floyd1(1,3) %这袜毁橘里我也不知道什么意思。但是能运行就是了。

可以写程咐毁袜序,并且不用编译就可以运行。

可以编译为独立的exe文件。查compile有关的命令,余茄Matlab书籍上都有介绍。

Matlab擅长图像处理,如果有问题,换个函数就行了,读图片不成问题。

写程序得看具体情况。

Matlab作为一个编程语言,我衡激个人的看法是:无所不能。


欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/yw/12336582.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-05-24
下一篇 2023-05-24

发表评论

登录后才能评论

评论列表(0条)

保存