Rank: 406 based on 265 downloads (last 30 days) and 16 files submitted
photo

DS

E-mail

Personal Profile:
Professional Interests:

 

Watch this Author's files

 

Files Posted by DS View all
Updated   File Tags Downloads
(last 30 days)
Comments Rating
27 Jan 2014 Screenshot Generate uniform pseudo-random integers from linear range. RAND_INT(R,N) returns an n-by-n matrix containing pseudo-random integer values from range R. Author: DS randi, random integer, rand 18 3
  • 5.0
5.0 | 2 ratings
10 Apr 2012 Screenshot Reverse concatenation: separate a data array along a specified dimension. INVERSE_CAT splits a given data array into sub-arrays along the specified dimension. Author: DS concatenation, cat, data manipulation 21 1
09 Apr 2012 Screenshot Convert decimal integer to arbitrary base. DECIMAL_CONVERT generates a vector of coefficients representing a base 10 integer in a chosen base. Author: DS base, polyval, polynomial, decimal to base, decimal to binary 15 0
30 Mar 2012 Screenshot Pad an image subregion, restoring it's original spatial context. REFRAME(I,R,B) applies PADARRAY to subregion, R, returning an image with the dimensions of image, I. Author: DS large binary object, regionprops, label image, paddarray 14 0
29 Mar 2012 Screenshot Generate a subdirectory listing from a path string. PATH_PARTS returns a listing of strings representing subdirectories parsed from a path string. Author: DS directory, subdirectory, path, string conversion 12 0
Comments and Ratings by DS View all
Updated File Comments Rating
29 Mar 2012 Round to Electronic Component Values Round numeric element values to IEC 60063 (E-Series) component values. Author: Stephen Cobeldick

Nice idea. Clearly documented and well-commented code. This should come in handy for circuit design.

22 Mar 2012 splitstring Split a string into a cell array by specifying a delimiter. Author: Ivar Eskerud Smith

If you have Matlab(2006a) or newer, you can use the 'split' option of the builtin function REGEXP to split a string into a cell array of substrings, like so:
parts = regexp(myText,’\s+’,'split’);

Comments and Ratings on DS's Files View all
Updated File Comment by Comments Rating
29 Oct 2013 Generate uniform pseudo-random integers from linear range. RAND_INT(R,N) returns an n-by-n matrix containing pseudo-random integer values from range R. Author: DS B, Travis

Sorry:
"range must be integers" --> "range bounds must be integers"
"range is integers" --> "range bounds are integers"

29 Oct 2013 Generate uniform pseudo-random integers from linear range. RAND_INT(R,N) returns an n-by-n matrix containing pseudo-random integer values from range R. Author: DS B, Travis

Suggestions:

if (numel(R)~=2),
error('Specified range must be a matrix with 2 elements.');
end

if (~prod(1*(R==floor(R)))),
error('Specified range must be integers.');
end

Updated first error msg to match modified numel check. Second error check confirms the range is integers (It's not immediately obvious, but non-integer range bounds can result in integers outside the bounds, which may not be what the user expects.) (I don't like the 1* in prod, but prod can't handle logical (in my older version anyway) and that converts logical to double which prod can handle.)

22 Jul 2013 Convert an A1-style spreadsheet column label to a number. ABC2NUM translates an A1-style (absolute) column label reference to a number; NUM2ABC does inverse. Author: DS yksiii

31 Aug 2012 Xflow Image analysis for Jet-in-crossflow data. Author: DS Yesil, Faruk

10 Apr 2012 Reverse concatenation: separate a data array along a specified dimension. INVERSE_CAT splits a given data array into sub-arrays along the specified dimension. Author: DS Simon, Jan

"x{i} = 1:5" is faster than "x(i) = {1:5}".
It would look nicer and save some micro-seconds to compute "floor(size(C,DIM)/nout)" once only and store it in a variable.
"ndims(C)" is nicer than "numel(size(C))".
The VARARGIN in the inputs is not used, so I suggest to omit it.
The first element does not need an exceptional handling, therefore I'd include it in the loops to simplify the code:
q = floor(size(C,DIM)/nout);
for i = 1:nout
x{i} = C(i*q - q + 1:i*q, :);
end
A method for indexing along any dimension:
Index = cell(1, ndims(C));
Index(:) = {':'};
for i = 1:nout
Index{DIM} = i*q - q + 1:i*q;
x{i} = C(Index{:});
end
But this is slower than the explicite method.

Contact us