Code covered by the BSD License  

Highlights from
CO2gui - lab control and automation

CO2gui - lab control and automation

by

 

06 Jan 2010 (Updated )

Software used for controlling and data logging lab equipment.

cellrep(input, match, replace)
function input = cellrep(input, match, replace)
% CELLREP replaces matching elements with the specified replacement (it can
% be anything at all)

% checks the number of arguments
error(nargchk(3, 3, nargin))

% error checking
if ~iscell(input)
    % the input must be a cell array
    error('This function only works on cell arrays.')
end

% for each cell
for m = 1:numel(input)
    % if it matches, replace it
    if isequal(input{m}, match)
        % replaces it
        input{m} = replace;
    end
end

Contact us