function CstChangeComponent(fid,CNew,COld)
global mws component;

    %Component.Rename "component1", "MyComponent"

    % Vytvoreni nove komponenty
    fprintf(fid, '%% Prejmenovani existujici komponenty\n');
    fprintf(fid, 'component = mws.invoke(''Component'');\n');
    fprintf(fid, ['component.invoke(''Rename'',''',COld,''',''',CNew,''');\n\n']);

    % Prime vytvoreni nove komponenty v CST
    component = mws.invoke('Component');
    component.invoke('Rename',COld,CNew);
end