1.自动生成变量 % auto general variabalsb=rand(3,3)for i=1:8 eval(['a_',num2str(i),'=','b(',num2str(i),');']); eval(['a_',num2str(i),]);end 运行结果: 2.自动保存文件 %auto save fileb=rand(3,3,3)for i=1:3 eval(['imwrite(b(:,:,',num2str(i),'),','''b_',num2str(i…
matlab tips and tricks and ... page overview: I created this page as a vectorization helper but it grew to become my annotated Matlab reading cache. In order to motivate the DSP people out there, I am showing below how one can apply a window and scal…
下面是 armijo线搜索+最速下降法的小程序,matlab用的很不熟,费了不少劲. 函数: function g=fun_obj(x) syms a b f = 1/2*a^2+b^2-a*b-2*a; a=x(1);b=x(2); g=eval(f); 求梯度: function g=fun_grad(x) syms a b f = 1/2*a^2+b^2-a*b-2*a; gradient = jacobian(f,[a,b]); a = x(1);b = x(2); g = eval(g…
clc; clear all; num = 10; for i = 1 : num IM = imread(sprintf('E:\\TEST\\PtzTEST2015-8-9\\image1280x720\\morning\\0-1\\X\\%03d-1.jpg', i)); eval(sprintf('IM%d = IM;', i)); end str = 'save data.mat'; for i = 1 : num str = sprintf('%s IM%d ', str, i);…
THIS IS AN EVOLVING WIKI DOCUMENT. If you find an error, or can fill in an empty box, please fix it! If there's something you'd like to see added, just add it. General Purpose Equivalents MATLAB numpy Notes help func info(func) or help(func) or func?…