⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 wrapmat.m

📁 智能优化算法: 粒子群优化算法(PSO)应用于神经网络优化程序。分为无隐含层、一隐含层、二隐含层。运行DemoTrainPSO.m即可。 程序来自:Brian Birge NCSU
💻 M
字号:
function [varargout]=wrapmat(in,r,c)
% WRAPMAT
%  converts a single row vector to one or more
%  RxC matrices
%
%  usage:
%     [M1,M2,...,MD]=WRAPMAT(O,R,C)
%
%  input:
%   O = row vector to matricize
%   R = row vector of row sizes for each input matrix
%   C = row vector of column sizes for each input matrix
%
% note: the sum of rows*columns must be the same
%       as the total length of the vector O
%    or in other words: the length of the R and C vectors
%       must be equal to each other and the number of output
%       matrices you want
%
%  output:
%   M1,M2,....,MD  = various sized matrices formed
% 
%  See also:  UNWRAPMAT

% Brian Birge
% Rev 1.0
% 7/25/01

if nargin<3
   error('Not enough input arguments.'); 
end

for k=1:nargout
   varargout{k}=reshape(in(1:r(k)*c(k)),r(k),c(k));
   in=in(r(k)*c(k)+1:end);
end

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -