导航:首页 > 源码编译 > 花样工具箱源码

花样工具箱源码

发布时间:2023-06-08 19:59:50

⑴ 如何找出MATLAB的工具箱源代码

有一些写成动态库的,你就看不见代码了。
你可以试一下,输入
edit 命令

比方说:
edit rgb2gray
这个是可以看见代码的。

而edit sqrt
会提示错误。

⑵ 如何查看matlab工具箱内置函数源代码

有几种方法可以实现查看matlab里自带函数的源代码:
在命令窗口中输入:

(1)、type 函数名(如 type rgb2gray 或者 type rgb2gray.m):即可在命令窗口中显示此函数的源代码;

(2)、open 函数名(如 open rgb2gray 或者 open rgb2gray.m):即可打开rgb2gray.m文件;

(3)、edit 函数名(如 edit rgb2gray 或者 edit rgb2gray.m):即可打开rgb2gray.m文件;

(4)、还有一种方法就是故意将原有函数的参数或类型写错,它就会提示错误,然后点击提示错误处,也可打开m文件,如:
rgb2gray(f, 3);%f为彩色图像文件名,后面的3是随意加上去的,因为函数rgb2gray原本就一个参数,现在为2个,肯定会报错

rgb2gray(f, 3);

??? Error using ==> iptchecknargin at 77
Function RGB2GRAY expected at most 1 input argument
but was called instead with 2 input arguments.

Error in ==> rgb2gray>parse_inputs at 76 %点击此处即可打开m文件
iptchecknargin(1,1,nargin,mfilename);

Error in ==> rgb2gray at 35 %点击此出也可打开m文件
X = parse_inputs(varargin{:});

不过,一些比较底层的源代码是看不见得。

⑶ 急求 matlab中函数ployfit的源代码! 我的matlab(2007b版)好像是工具箱不完全,没有ployfit这个函数~

function [p,S,mu] = polyfit(x,y,n)
%POLYFIT Fit polynomial to data.
% P = POLYFIT(X,Y,N) finds the coefficients of a polynomial P(X) of
% degree N that fits the data Y best in a least-squares sense. P is a
% row vector of length N+1 containing the polynomial coefficients in
% descending powers, P(1)*X^N + P(2)*X^(N-1) +...+ P(N)*X + P(N+1).
%
% [P,S] = POLYFIT(X,Y,N) returns the polynomial coefficients P and a
% structure S for use with POLYVAL to obtain error estimates for
% predictions. S contains fields for the triangular factor (R) from a QR
% decomposition of the Vandermonde matrix of X, the degrees of freedom
% (df), and the norm of the resials (normr). If the data Y are random,
% an estimate of the covariance matrix of P is (Rinv*Rinv')*normr^2/df,
% where Rinv is the inverse of R.
%
% [P,S,MU] = POLYFIT(X,Y,N) finds the coefficients of a polynomial in
% XHAT = (X-MU(1))/MU(2) where MU(1) = MEAN(X) and MU(2) = STD(X). This
% centering and scaling transformation improves the numerical properties
% of both the polynomial and the fitting algorithm.
%
% Warning messages result if N is >= length(X), if X has repeated, or
% nearly repeated, points, or if X might need centering and scaling.
%
% Class support for inputs X,Y:
% float: double, single
%
% See also POLY, POLYVAL, ROOTS, LSCOV.

% Copyright 1984-2008 The MathWorks, Inc.
% $Revision: 5.17.4.10 $ $Date: 2008/06/20 08:00:56 $

% The regression problem is formulated in matrix format as:
%
% y = V*p or
%
% 3 2
% y = [x x x 1] [p3
% p2
% p1
% p0]
%
% where the vector p contains the coefficients to be found. For a
% 7th order polynomial, matrix V would be:
%
% V = [x.^7 x.^6 x.^5 x.^4 x.^3 x.^2 x ones(size(x))];

if ~isequal(size(x),size(y))
error('MATLAB:polyfit:XYSizeMismatch',...
'X and Y vectors must be the same size.')
end

x = x(:);
y = y(:);

if nargout > 2
mu = [mean(x); std(x)];
x = (x - mu(1))/mu(2);
end

% Construct Vandermonde matrix.
V(:,n+1) = ones(length(x),1,class(x));
for j = n:-1:1
V(:,j) = x.*V(:,j+1);
end

% Solve least squares problem.
[Q,R] = qr(V,0);
ws = warning('off','all');
p = R\(Q'*y); % Same as p = V\y;
warning(ws);
if size(R,2) > size(R,1)
warning('MATLAB:polyfit:PolyNotUnique', ...
'Polynomial is not unique; degree >= number of data points.')
elseif warnIfLargeConditionNumber(R)
if nargout > 2
warning('MATLAB:polyfit:RepeatedPoints', ...
['Polynomial is badly conditioned. Add points with distinct X\n' ...
' values or rece the degree of the polynomial.']);
else
warning('MATLAB:polyfit:RepeatedPointsOrRescale', ...
['Polynomial is badly conditioned. Add points with distinct X\n' ...
' values, rece the degree of the polynomial, or try centering\n' ...
' and scaling as described in HELP POLYFIT.']);
end
end
r = y - V*p;
p = p.'; % Polynomial coefficients are row vectors by convention.

% S is a structure containing three elements: the triangular factor from a
% QR decomposition of the Vandermonde matrix, the degrees of freedom and
% the norm of the resials.
S.R = R;
S.df = max(0,length(y) - (n+1));
S.normr = norm(r);

function flag = warnIfLargeConditionNumber(R)
if isa(R, 'double')
flag = (condest(R) > 1e+10);
else
flag = (condest(R) > 1e+05);
end

⑷ VB编写的局域网聊天工具源代码

用VB做聊天程序的方法

---- 所谓"聊天"是指两个程序能够发送数据给对方。这个程序涉及到数据通讯的知识,仿佛很复杂,不过,由于VB给我们提供了一个Winsock控件,问题就变得很简单了。

---- 先编写"聊天(主机)"程序。在窗体里添加Winsock控件,并设置其Protocol属性为1-SckUDPProtocol,其他属性为缺省值。接着添加两个标签和两个文本框,设置两个标签的标题属性分别为"接收窗"和"发送窗";两个文本框的标题属性为空。最后编写代码:

---- 1."聊天(主机)"

Private Sub Form-Load()
′设置网络地址
Winsock1.LocalPort=1024
Winsock1.RemoteHost="202.96.6.1"
Winsock1.RemotePort=1999
End Sub
Private Sub Text1-Change()
′发送用户输入的内容
Winsock1.SendData Text1.Text
End Sub
Private Sub Winsock1-DataArrival
(Byval bytesTotal As Long)
Dim rec As String
′接收对方数据并在文本框内显示
Winsock1.GetData rec, vb String
Text2.Text=rec
End Sub

---- 2."聊天(副机)"

Private Sub Form_Load()
′设置网络地址
Winsock1.LocalPort=1999
Winsock1.RemoteHost="202.96.6.1"
Winsock1.RemotePort=1024

---- 其他部分程序与(主机)相同。最后将两个程序存盘,并编译成执行(.Exe)文件。现在就可以使用这个程序进行对话了。
---- 七.文本框中文本的某一特定字符或字符串同时高亮显示的方法

---- 由于普通TextBox控件不支持不连续字符串的同时高亮显示,所以我们选择RichTextBox控件。单击工程(Project)选单项,在弹出的下拉选单中单击组件(Components)选单项,从弹出的对话框中选择Microsoft Rich Textbox Control 5.0复选框,确定加载RichTextBox控件。

---- 新建(New)一个工程,在窗体(Form)上添加一个RichTextBox控件和两个Command(按钮)控件,都采用系统默认的Name属性值;设置RichTextBox的Text属性值为空,Command1和Command2的Caption属性值分别设为"输入文本"和"选择字符串"。最后,添加如下VB代码:

Private Sub Command1-Click()
Dim str As String
Dim Text As String
str=〃输入文本〃
Text=InputBox(str)
RichTextBox1.Text=Text
End Sub
Private Sub Command2-Click()
Dim str As String
Dim Text As String
Dim Position As Integer
Dim Lenth As Integer
str=〃输入要高亮显示的字符串〃
Text=InputBox(str)
If Text 〈〉 〃〃 Then
Position=InStr(RichTextBox1.Text, Text)-1
Lenth=Len(Text)
RichTextBox1.SelStart=Position
RichTextBox1.SelLength=Lenth
RichTextBox1.SelColor=RGB(255,0,0)
Do While InStr(Position+Lenth+
1, RichTextBox1.Text, Text) 〈〉 0
Position=InStr(Position+Lenth+
1, RichTextBox1.Text, Text)-1
RichTextBox1.SelStart=Position
RichTextBox1.SelLength=Lenth
RichTextBox1.SelColor=RGB(255,0,0)
Loop
End If
End Sub

---- 按F5执行程序,单击"输入文本"按钮,在弹出的对话框中输入一些文本,确定后,刚刚输入的文本将显示在RichTextBox中;再单击"选择字符串"按钮,在弹出的对话框中输入你希望高亮显示的字符串,确定后,RichTextBox中相应的字符串将以红色高亮显示。
---- 八.编程实现Windows 95/98操作系统热启动的方法

---- 要利用程序实现系统的重新启动,可以在你的程序中调用API函数来实现。建一个子函数:(以VB为例)

Declare Function SystemParametersInfo Lib 〃
user32〃 Alias -
〃SystemParametersInfo〃 (ByVal uAction As Long,
ByVal uParam As Long,
ByVal lpvParam As Any, ByVal
fuWinIni As Long) As Long
Sub DisableCtrlAltDelete(bDisabled As Boolean)
Dim X As Long
X=SystemParametersInfo(97, bDisabled, CStr(1), 0)
End Sub
Call DisableCtrlAltDelete(true) ′禁止热启
Call DisableCtrlAltDelete(false) ′允许热启

---- 九.在Windows 95/ 98启动后自动启动程序的方法
---- 我们都知道在Windows 95/98的"开始"→"程序"选单下有一"启动"选单项,当每次启动Windows 95或Windows 98时,系统都会自动启动放在"启动"选单栏里的可执行程序。

---- 但目前有好多软件,像解霸五、ICQ,以及大部分实时侦测病毒的软件等等,安装后,并没有放在"启动"选单里,也能在启动操作系统时自动启动。怎么实现的呢?

---- 其实只要知道Windows注册表的一些知识,这个问题就不能称之为问题了。用鼠标单击"开始",打开开始选单,再单击"运行",出现一对话框,然后输入"regedit",确定后,会打开系统注册表编辑器,找到HKEY-LOCAL-MACHINE? SOFTWARE?Microsoft?Windows?CurrentVersion?Run,加入你的程序的入口,就可以了。如果不知道怎么加,就参考一下已经存在的键值。

---- 十. 如何把数据文件输出到Text控件中?如果数据量比较大,窗体满屏也不够大,怎么解决?

---- 有一个比较简单的方法,就是把数据放到一个文本框(Text)里,并在其中加上水平和垂直滚动条。具体实现步骤为:先在窗体(Form)里加入一个文本框,采用默认名Text1;然后,设置文本框Text1的属性:Text属性设置为空,MultiLine属性设置为True,ScrollBars属性设置为3-Both;接着添加如下VB代码:

Private Sub Form-Load()
Dim Handle As Integer
Dim FileName As String
On Error GoTo ErrExit
begin:
′输入要显示的数据文件的名称
FileName=InputBox$(〃Input Filename〃,
〃Open File〃)
On Error GoTo FileErr
Handle=FreeFile
Open FileName For Input As #Handle
′把数据文件中的数据输出到文本框中
Text1.Text=Input$(LOF(Handle), Handle)
Close #Handle
Exit Sub
FileErr:
Dim ErrNum As Integer
If Err.Number=53 Then
ErrNum=MsgBox(〃File not exist〃,
vbOKCancel, 〃Error Information〃)
If ErrNum=1 Then
GoTo begin
Else
Exit Sub
End If
End If
MsgBox Err.Description, , 〃file open failed〃
ErrExit:
Exit Sub
End Sub
′使文本框充满整个窗体
Private Sub Form-Resize()
Text1.Left=0
Text1.Top=0
Text1.Width=Form1.Width-100
Text1.Height=Form1.Height-400
End Sub
---- 通过这样的处理,不仅能解决问题,而且用户还可以在文本框中对数据进行编辑。
---- 十一.关联文件列表框、目录列表框和驱动器列表框的方法

---- 想做一个对话窗体,包含驱动器列表框、目录列表框和文件列表框,并能实现三者的同步操作,怎么做?这都是我们在实际应用中经常会遇到的问题,在VB中解决这个问题非常简单,可以通过Path属性的改变引发Change事件来实现。例如:

Sub Dir1-Change()
File1.Path=Dir1.Path
End Sub

---- 该事件过程使窗体上的目录列表框Dir1和文件列表框File1产生同步。因为目录列表框Path属性的改变将产生Change事件,所以在Dir1-Change事件过程中,把Dir1.Path赋给File1.Path,就可以产生同步效果。类似地,增加下面的事件过程,就可以使三种列表框同步操作:
Sub Drive1-Change()
Dir1.Path=Drive1.Drive
End Sub

---- 该过程使驱动器列表框和目录列表框同步,前面的过程使目录列表框和文件列表框同步,从而使三种列表框同步,问题即可解决。

阅读全文

与花样工具箱源码相关的资料

热点内容
dvd光盘存储汉子算法 浏览:758
苹果邮件无法连接服务器地址 浏览:963
phpffmpeg转码 浏览:672
长沙好玩的解压项目 浏览:145
专属学情分析报告是什么app 浏览:564
php工程部署 浏览:833
android全屏透明 浏览:737
阿里云服务器已开通怎么办 浏览:803
光遇为什么登录时服务器已满 浏览:302
PDF分析 浏览:486
h3c光纤全工半全工设置命令 浏览:143
公司法pdf下载 浏览:383
linuxmarkdown 浏览:350
华为手机怎么多选文件夹 浏览:683
如何取消命令方块指令 浏览:350
风翼app为什么进不去了 浏览:779
im4java压缩图片 浏览:362
数据查询网站源码 浏览:151
伊克塞尔文档怎么进行加密 浏览:893
app转账是什么 浏览:163