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

Brad Stiritz

E-mail

Personal Profile:
Professional Interests:
algorithmic trading, object-oriented design, software quality methodologies

 

Watch this Author's files

 

Comments and Ratings by Brad View all
Updated File Comments Rating
21 Jul 2013 Compare Structures Compares two structured variables recursively and notes where the two structures are different. Author: michael arant

Very useful function, but message output is not conducive to machine-processing. It would be helpful to have an option to return only the non-matching field names per se.

I didn't choose to modify the function code, but instead wrote a helper function which extracts the field names from the output messages. Here's the core logic, hope it may be helpful to someone..

%{
Here's an example of the message output from comp_struct():

>>st_1.NAME = 'abc';
>>st_2.NAME = 'def';
>>[~,cv_st_1_msgs] = comp_struct(st_1,st_2,0,0,0,'','',0)
cv_st_1_msgs = '(1).NAME and (1).NAME do not match'

We want to extract 'NAME' from this string. Using free utility Expresso, I
developed a regular expression to capture the first occurence of 'NAME'.
%}

% Declare regular expression to capture field name from comp_struct()
% message output:
regex = '\(.*\)\.(.*)\sand';

% Apply (regex) to all comp_struct output strings & return the capture groups as an (N x 1) cell vector of doubly-nested cell vectors containing the token match.
cv_cv_cv_fieldnames = regexp(cv_messages,regex,'tokens');

% Preallocate output:
cv_fieldnames = cell(N_fields,1);

% Iterate through the regexp() output:
for i_field = 1 : N_fields

% Assign (i)'th output element:
cv_fieldnames{i_field} = cv_cv_cv_fieldnames{i_field}{1}{1};
end

30 Jul 2012 Write Cell Array to Text File A cell array is written to a delimited output file, incl. options for appending & custom delimiters. Author: Roland Pfister

This utility doesn't work consistently for me. Specific problems:

1) Documentation states that file name is taken as the file specification. However, the function occasionally generates errors like the following:

------------------------------
Error using fprintf
Invalid file identifier. Use fopen to generate a valid file identifier.

Error in dlmcell (line 98)
fprintf(output_file,'%s',output{i,j});
------------------------------

fprintf() requires a file handle as first argument. I'll therefore have to dig into this F/E function & possibly modify.

2) This function doesn't return any values, even on error. Instead, it prints error messages at the command-line & returns normally. This is poor programming practice & makes it inconvenient to deploy within another function where error-detection must be handled programmatically.

One star subtracted for each of these problems.

18 Nov 2011 Design Pattern: Singleton (Creational) A MATLABĀ® OOP implementation of the Singleton Creational Design Pattern Author: Bobby Nedelkovski

Thank you Bobby! for your excellent implementation of this classic design pattern. I especially appreciate your extensive documentation & excellent, highly-descriptive coding style.
5-stars well-deserved. If only all MATLAB code could look like this! Highly recommended.

24 Jul 2011 subdir: a recursive file search Performs a recursive file search using same input and output format as dir function Author: Kelly Kearney

Perfect! Just what I needed. Very appreciated, thank you :)

25 Jan 2011 Class Inheritance Browser A tool for managing and organizing classes, with a simple interface and (optional) tree diagram. Author: Clayton Ernst

Very helpful utility! Highly recommended! I launch this browser from a Matlab toolbar button.
Just a couple of minor notes :
(1) I commented-out browse.m lines 24-31 to suppress annoying error messages about bioinfo toolbox; maybe please wrap those in a conditional, if possible?
(2) Long identifier strings can easily get cut off & scrolling within the columns is no fun. Maybe please consider resizing window contents when window is resized?
Otherwise, great work! Thank you very much for this submission :)

Contact us