Rank: 115490 based on 0 downloads (last 30 days) and 0 file submitted
photo

Christian Dorion

E-mail
Company/University
Desautels Faculty of Management

Personal Profile:
Professional Interests:

 

Watch this Author's files

 

Comments and Ratings by Christian View all
Updated File Comments Rating
06 Dec 2011 Pack & Unpack variables to & from structures with enhanced functionality v2struct packs and unpacks variables to and from structures with enhanced functionality. Author: Adi Navve

Hi,
This is a nice tool; I had one of my own but never nearly as extensive as this one. Unfortunately, there seems to be an issue with variable names that are also function names. I couldn't solve it, maybe you could...

If, for example, you write

S = struct('sigma',0.25);
v2struct(S);
whos
sigma

on the command prompt, you have that sigma is 0.25. However, if you wrap this into function test.m (not a script, a function) then you have this oddity:

>> test
Name Size Bytes Class Attributes

S 1x1 184 struct
sigma 1x1 8 double

??? Error using ==> sigma at 83
Not enough input arguments.

Error in ==> test at 5
sigma

where Matlab tries to call a function called sigma!?

Any clue?

13 Oct 2009 Performing random numbers generator from a generic discrete distribution This function extracts random numbers distributed over a discrete set; the PDF is user-defined Author: Gianluca Dorini

Hi,
Thanks for sharing this file. I suggest you replace the hardcoded 32767 by RAND_MAX... Otherwise it works like a charm.

21 Apr 2009 export_fig Exports figures nicely to a number of vector & bitmap formats. Author: Oliver Woodford

Great piece of work, thanks.

A minor thing though... Under my installation, the private/ghostscript.m function had a minor bug that resulted in the whole function being whipped out and replaced by solely the 'gs' path. Just in case it happens to anyone else, here is a simple patch:

--- MY/private/ghostscript.m
+++ ONLINE/private/ghostscript.m
@@ -103,9 +103,8 @@
fstrm = fread(fh, '*char')';
fclose(fh);
% Find the path
-first_sec = regexp(fstrm, '[\n\r]*function path = current_gs_path[\n\r]*path = ''', 'end', 'once');
-second_sec = first_sec + regexp(fstrm(first_sec+1:end), ''';[\n\r]*return', 'once');
-assert(~isempty(first_sec) && ~isempty(second_sec));
+first_sec = regexp(fstrm, '[\n\r]function path = current_gs_path[\n\r]path = ''', 'end', 'once');
+second_sec = first_sec + regexp(fstrm(first_sec+1:end), ''';[\n\r]return', 'once');
% Save the file with the path replaced
fh = fopen(fname, 'wt');
fprintf(fh, '%s%s%s', fstrm(1:first_sec), path, fstrm(second_sec:end));

Contact us