Group: http://groups.google.com/group/mathtools/topics
- Switching current figure by name silently [1 Update]
- KL Divergence [1 Update]
- Max 2d for Matlab [1 Update]
- Save Matlab figure as shown exactly [1 Update]
Haifeng GONG <haifen...@gmail.com> May 19 03:18PM -0700 ^
function hr = get_figure(name)
% If we switch current figure in a loop, Matlab brings the figure to
the front.
% If the program runs a long time, this behavior is boring while we
are working on other program simultaneously.
% This function will suppress this unwanted behavior.
h = findobj('Name', name);
for ii=1:length(h)
if strcmp('figure', get(h, 'Type')) ~=0
%figure(h(ii));
hr = h(ii);
set(0, 'CurrentFigure', hr);
return;
end
end
hr = figure('Name', name);
--
You received this message because you are subscribed to the Google Groups "MathTools" group.
To post to this group, send email to math...@googlegroups.com.
To unsubscribe from this group, send email to mathtools+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/mathtools?hl=en.
Topic: KL DivergenceHaifeng GONG <haifen...@gmail.com> May 19 03:14PM -0700 ^
function v = kldivergence(hp, hq)
v = sum(hp.* log( (hp+1e-6)./(hq+1e-6) ) );
if v<0
v=0;
end
--
You received this message because you are subscribed to the Google Groups "MathTools" group.
To post to this group, send email to math...@googlegroups.com.
To unsubscribe from this group, send email to mathtools+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/mathtools?hl=en.
Topic: Max 2d for MatlabHaifeng GONG <haifen...@gmail.com> May 19 03:10PM -0700 ^
function [Val, Ind1, Ind2]=max2d(Mat);
%--------------------------------------------------------------------------
% max2d function 2d maximum function. Return the maximum value
% and index in a 2d matrix.
% Input : - Matrix.
% Output : - Maximum value.
% - [I,J] index of maximum.
% Tested : Matlab 5.3
% By : Eran O. Ofek October 2000
% URL : http://wise-obs.tau.ac.il/~eran/matlab.html
%--------------------------------------------------------------------------
[V1,I1] = max(Mat);
[V2,I2] = max(V1);
Val = V2;
Ind1 = I1(I2); % I
Ind2 = I2; % J
--
You received this message because you are subscribed to the Google Groups "MathTools" group.
To post to this group, send email to math...@googlegroups.com.
To unsubscribe from this group, send email to mathtools+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/mathtools?hl=en.
Haifeng GONG <haifen...@gmail.com> May 19 03:06PM -0700 ^
--
figure('Name', 'fig name', 'Position', [185 55 766 887]);
% draw code here
set(gcf, 'PaperPositionMode', 'auto');
saveas(gcf, 'filename.png');
--
You received this message because you are subscribed to the Google Groups "MathTools" group.
To post to this group, send email to math...@googlegroups.com.
To unsubscribe from this group, send email to mathtools+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/mathtools?hl=en.
You received this message because you are subscribed to the Google Groups "MathTools" group.
To post to this group, send email to math...@googlegroups.com.
To unsubscribe from this group, send email to mathtools+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/mathtools?hl=en.