Code covered by the BSD License  

Highlights from
Circuit Analysis Toolbox

Circuit Analysis Toolbox

by

 

The circuit analysis toolbox allows you to perform an AC analysis of a circuit.

cirDescNew=edit_desc(cirDesc)
function cirDescNew=edit_desc(cirDesc)  %#ok<STOUT>
% Function to edit a circuit description (a cell variable) 
% This function is used to edit the information within the cell variable
% holding the circuit description. A UITABLE is used to make the
% information visible. When the figure is closed, the edited information is
% placed in the output cell variable.
%
% The "cirDesc" cell array contains  
%       component types
%       component designators
%       "from" nodes
%       "to" nodes
%       component values
%       component positive tolerances
%       component negative tolerances
%       control branches (of dependent sources)
%
% EXAMPLE: 
%         newCircuitDescription = edit_desc(circuitDescription)

% Author: John McDermid
% Created: October 1, 2009

% Create a figure for the uitable
descTableHandle=figure;
set(descTableHandle,...
    'Position',[560 528 610 300],...
    'MenuBar','none',...
    'Name','Edit Circuit Description',...
    'NumberTitle','off');

% Create a uitable to edit the circuit description
cnames={'Component|Type' 'Reference|Designator' 'From|Node' 'To|Node',...
    'Value|(Fundamental|Units)' 'Positive|Tolerance|(%)',...
    'Negative|Tolerance|(%)' 'Control|Branch'};
typeNames={'V' 'I' 'R' 'L' 'C' 'IDI' 'VDI' 'VDV'};
columnformat={typeNames,'char','char','char','numeric',...
    'numeric','numeric','char'};
columnEditable=[true true true true true true true true];
uitable(descTableHandle,...
    'Data',cirDesc,...
    'ColumnName',cnames,...
    'ColumnFormat',columnformat,...
    'ColumnEditable',columnEditable,...
    'RowName',[], ...
    'Position',[0 0 610 300]); 

% Define the "close request" string which is executed as a command when the
% figure is closed
set(descTableHandle,'CloseRequestFcn',@my_close_request);

% Wait for the figure to be closed
waitfor(descTableHandle);

function my_close_request(hObject,~)
% Places edited information in the calling function when the GUI is closed.
% Function closes the figure and assigns the new circuit description in
% the callers workspace before closing.
uiTableHandle=get(hObject,'Children');
desc=get(uiTableHandle,'Data');
assignin('caller','cirDescNew',desc);
snapnow
delete(gcbf)

Contact us