Search Comments and Ratings

go

   
Date File Comment by Comment Rating
02 Sep 2013 Functional Programming Constructs A set of files for treating many operations, like "if", "for", and even "()", as functions. Author: Tucker McClure Felipe

output.m could reuse wrap.m, it seems:
function varargout = output(f, out_indices)
varargout = wrap(f, out_indices);
end

21 Aug 2013 convert_humidity Convert humidity between different formats. Author: Felipe G. Nievinski Felipe

pls see <http://articles.chicagotribune.com/2011-07-20/news/ct-wea-0720-asktom-20110720_1_relative-humidity-condensation-nuclei-supersaturated-air>

11 Aug 2013 Functional Programming Constructs A set of files for treating many operations, like "if", "for", and even "()", as functions. Author: Tucker McClure Felipe

Thanks for taking the time to comment, Tucker.

09 Aug 2013 Functional Programming Constructs A set of files for treating many operations, like "if", "for", and even "()", as functions. Author: Tucker McClure Felipe

I'm wondering if it's possible to harmonize the behavior of the curly.m function with that of the built-in {} in this case:
x = {'a' 'b'}, {x{:}}, {curly(x,':')}
x =
'a' 'b'
ans =
'a' 'b'
ans =
'a'
I don't think it's a problem with curly.m, as these anonymous functions also exhibit the same discord:
curlycolon = @(x) x{:}; {curlycolon(x)}
ans =
'a'
curlycolon = @(x) subsref(x, substruct('{}',{':'})); {curlycolon(x)}
ans =
'a'
I seems to be a specificity of the colon operator; from doc colon: "The colon notation can be used with a cell array to produce a comma-separated list. ... The comma-separated list syntax is valid inside () for function calls, [] for concatenation and function return arguments, and inside {} to produce a cell array."

I came across this problem trying to define this function:
subvec2ind = @(siz, subvecnum) use(num2cell(subvecnum), @(subveccell) sub2ind(siz, subveccell{:}));
subvec2ind([5 5 5], [1 2 3])
sub2ind([5 5 5], 1, 2, 3)

04 Aug 2013 suplabel Places text as a title, xlabel, or ylabel on a group of subplots. Author: Ben Barrowes Felipe

if (nargout < 2), clear h; end
if (nargout < 1), clear ax; end

04 Aug 2013 suplabel Places text as a title, xlabel, or ylabel on a group of subplots. Author: Ben Barrowes Felipe

Hint: if you need to specify the optional supAxes argument, do set(ax,'Visible','one'), redimension it manually/visually, then do get(ax,'Position') to obtain the desired value.

29 Jul 2013 figtitle Create a title for a figure with multiple subplots. Author: Chad Greene Felipe

Could you please compare figtitle to "mtit", FX submission #3218? Thanks.

12 Jun 2012 fixfig FIXFIG modifies a Matlab figure so it can be used in on-screen presentations such as Powerpoint. Author: M. A. Hopcroft Felipe

I've had to add the following at line #151:

% z axis label
set(get(i,'ZLabel'),'FontSize',fontsizefact*9,'FontWeight','bold','FontName',myfont)

16 May 2012 logzplot Easily create surface plots with logarithmic z-axis and color scale. Author: John Barber Felipe

Thanks a lot for your submission. I like specially the colorbar update callbacks. I was mostly interested in the log-scaled colorbar. I wanted to use it for images. I could get the picture that I wanted plotting the data as a surface then setting view(2) and 'EdgeColor','none', but for large images it's slower. So I've added support for images, e.g., logzplot(X,Y,Z,@image,'colorbar'), or h=image(Z); logzplot(h,'colorbar'); I also needed the colorbar handle (to adorn it with titles, etc.) so now it's a return value. Here are the diffs in case you want to incorporate:

1c1
< function h = logzplot(varargin)
---
> function [h,h2] = logzplot(varargin)
283c283
< plotFunList = {'surf','pcolor','mesh','trisurf','trimesh'};
---
> plotFunList = {'surf','pcolor','mesh','trisurf','trimesh','image'};
349c349
< case {'surf','mesh','pcolor'}
---
> case {'surf','mesh','pcolor','image'}
453a454,456
> case 'image'
> CDataName = 'CData';
> pcolorFlag = 1; % avoid setting ZScale.
485a489,498
> case 'image'
> CDataName = 'CData';
> pcolorFlag = 1; % avoid setting ZScale.
> if isvector(x), x2 = x; else x2 = x(1,:); end
> if isvector(y), y2 = y; else y2 = y(:,1); end
> hAx2 = gca();
> axes(hAx) %#ok<MAXES>
> hSurf = plotFun(x2,y2,CData);
> axes(hAx2) %#ok<MAXES>
> set(hAx, 'YDir','normal')
537a551
> hCbar = [];
539c553
< LogZPlotColorbar(hFig,hAx)
---
> hCbar = LogZPlotColorbar(hFig,hAx);
567c581
< if nargout == 1
---
> if nargout > 0
569a584,586
> if nargout > 1
> h2 = hCbar;
> end
683c700
< case {'surface','patch'}
---
> case {'surface','patch','image'}
702c719
< hSurf = findobj(hAx,'Type','surface','-or','Type','patch');
---
> hSurf = findobj(hAx,'Type','surface','-or','Type','patch','-or','Type','image');
725c742
< function LogZPlotColorbar(hFig,hAx,hCbar)
---
> function hCbar = LogZPlotColorbar(hFig,hAx,hCbar)

16 May 2012 logzplot Easily create surface plots with logarithmic z-axis and color scale. Author: John Barber Felipe

02 May 2012 FresnelS and FresnelC Efficient and accurate computation of the Fresnel sine and cosine integrals Author: John D'Errico Felipe

Hi John. Thanks for citing ("acknowledging") related submissions. There are two new ones, that came after yours: 33577 and 34134. You might want to cite these, too. That way folks will find your submission in all cases. I'm trying to kill duplicates. I'm assuming yours is superior -- both in accuracy and speed, not to mention readability.

22 Apr 2012 Advanced hline and vline Draws horizontal/vertical lines in graphs. Accept axes handle and allows user to specify label posit Author: Hoi Wong Felipe

I'd add at the end:
if (nargout == 0), clear lineHandles; end

03 Feb 2012 lapack Easily call any LAPACK or BLAS routine from inside Matlab. Author: Tim Toolan Felipe

Qianyong Chen, I think the segfault was because lwork was too small; doing as follows doesn't seem to crash matlab. The fortranError as well as fortranError_SVD remain both numerically zero.

A = rand(118,106);

% 1st: results from direct matlab
[UM, SM, VM] = svd(A);

matlabError = max(max(abs(A-UM*SM*VM')))

% 2nd: results when using 'lapack' by Tim Toolan
[m,n] = size(A);

C = lapack('DGESVD', 'A','A',m, ...
n,A,m, zeros(n,1), zeros(m),m,zeros(n),n,zeros(1,1),-1,0)
lwork = C{end-2}(1);
C = lapack('DGESVD', 'A','A',m, ...
n,A,m, zeros(n,1), zeros(m),m,zeros(n),n,zeros(lwork,1),lwork,0);
[SF, UF, VFt] = C{[7,8,10]};
VF = VFt';

fortranError_U = max(max(abs(UM - UF)))
fortranError_V = max(max(abs(VM - VF)))
fortranError_SVD = max(abs(SF - diag(SM) ))

fortranError = max(max(abs( A - UF * SM * VF')))

Contact us