📄 ft_help.m
字号:
%--------------------------------------------------------------------- % function [] = FT_help(help_name)% % Prints list of available function with short description%% Part of the SimTools package% Andreas Freise 22.07.08 afreise@googlemail.com%--------------------------------------------------------------------- function [] = FT_help(help_name) disp(sprintf('\n --------------------------------------------------------------------------')); disp(sprintf(' SimTools 0.5, Andreas Freise, 04.07.2008 Matlab utility functions')); disp(sprintf(' to be used with Finesse (www.rzg.mpg.de/~adf) or other simulation tools')); disp(sprintf(' --------------------------------------------------------------------------')); disp(sprintf(' ')); % print usage when no input argument is given if (nargin==0) print_usage(); return; end keywords=[{'all'},{'kat'},{'finesse'}, {'example'}, {'block'}, {'comment'}, {'maps'}, {'parse'}, {'file'}, ... {'line'}]; nkeywords=length(keywords); % print function help if input argument is a full function name help_type=exist(help_name); if (help_type==2) disp(sprintf('Displaying help of M-file "%s"',help_name)); help_string=['help ',help_name]; eval(help_string); return; end % set list of function names and descriptions with keywords n=0; n=n+1; h(n).str={'FT_help : prints this help'}; n_last=n+1; n=n+1; h(n).str={'FT_example1, FT_example2 : example scripts using these functions'}; for i=n_last:n h(i).keyword='example '; end n_last=n+1; n=n+1; h(n).str={'FT_create_new_block : creates a new "block" variable'}; n=n+1; h(n).str={'FT_read_blocks_from_file : read all blocks from the given file'}; n=n+1; h(n).str={'FT_list_block_names : prints names of blocks in given list'}; n=n+1; h(n).str={'FT_print_block : print text lines of a block'}; n=n+1; h(n).str={'FT_copy_block : copy a block given by name from one list to another'}; n=n+1; h(n).str={'FT_write_blocks_into_file : write list of blocks to .kat file'}; n=n+1; h(n).str={'FT_add_line_to_block : adds a text line to a block'}; n=n+1; h(n).str={'FT_find_text_in_all_blocks : gives index of block+lines containing given string'}; n=n+1; h(n).str={'FT_find_text_in_block : gives index of a text line containing given string'}; n=n+1; h(n).str={'FT_find_text_in_active_block : like FT_find_text_in_block but excludes comment lines'}; n=n+1; h(n).str={'FT_remove_lines_from_block : remove text line of given index '}; n=n+1; h(n).str={'FT_copy_lines_block_to_block : copy selected text line from one block to another'}; n=n+1; h(n).str={'FT_find_element_in_all_blocks : returns block and line numbers where an element has been found'}; ... n=n+1; h(n).str={'FT_find_element_in_block : returns line numbers where an element has been found'}; n=n+1; h(n).str={'FT_find_element_in_active_block : like FT_find_element_in_block but excludes comment lines'}; n=n+1; h(n).str={'FT_index_of_block : prints the list index of a block given by name name'}; for i=n_last:n h(i).keyword='block '; end n_last=n+1; n=n+1; h(n).str={'FT_get_element_from_line : returns one element and its position in a text line'}; n=n+1; h(n).str={'FT_replace_value_in_line : replaces one element in a text line'}; n=n+1; h(n).str={'FT_parse_line : reads names or values from a text line'}; n=n+1; h(n).str={'FT_split_line : splits a line of text into cells'}; for i=n_last:n h(i).keyword='line parse '; end n_last=n+1; n=n+1; h(n).str={'FT_comment_block : add %% in front of all lines in a block'}; n=n+1; h(n).str={'FT_uncomment_block : remove all %% or # in front of all lines in a block'}; n=n+1; h(n).str={'FT_comment_lines_in_block : add %% in front of selected lines'}; n=n+1; h(n).str={'FT_uncomment_lines_in_block : removes all %% or # chars from selected lines'}; n=n+1; h(n).str={'FT_remove_comment_char_in_block : removes one %% or # char from selected lines'}; n=n+1; h(n).str={'FT_add_comment_char_to_line : add %% in front of a given string'}; n=n+1; h(n).str={'FT_remove_comment_char_from_line: removes one %% or # char from the start of a given string'}; n=n+1; h(n).str={'FT_uncomment_line : removes all %% or # chars from the start of a given string'}; n=n+1; h(n).str={'FT_remove_comment_line : remove line if it starts with %% or #'}; n=n+1; h(n).str={'FT_remove_comment_from_line : remove trainling comment from line'}; for i=n_last:n h(i).keyword='comment '; end n_last=n+1; n=n+1; h(n).str={['FT_create_new_FT : creates the main FT variable (stores lcoation of Finesse ' ... 'binary)']}; n=n+1; h(n).str={'FT_create_new_kat_run : creates a new "run" variable'}; n=n+1; h(n).str={'FT_read_kat_constant : reads values of a given constant in a block'}; n=n+1; h(n).str={'FT_write_kat_constant : overwrites values of a given constant in a block'}; n=n+1; h(n).str={'FT_run_kat_simulation : run Finesse on given file and load data'}; n=n+1; h(n).str={'FT_check_for_kat_binary : checks if Finesse binary given in FT can be found'}; n=n+1; h(n).str={'FT_prepare_kat_filename : check consitency of .kat filename'}; n=n+1; h(n).str={'FT_set_kat_filenames : creates filename for .kat, .out and .log files'}; n=n+1; h(n).str={'FT_read_kat_output_header : reads header of an .out file'}; n=n+1; h(n).str={'FT_read_kat_output_data : read .out file after a Finesse run'}; n=n+1; h(n).str={'FT_kat_clean : deletes all output files from a Finesse run'}; for i=n_last:n h(i).keyword='kat finesse '; end n_last=n+1; n=n+1; h(n).str={'FT_new_surface_map : stores the data of a surface map into a structure "map"'}; n=n+1; h(n).str={'FT_write_surface_map : writes data from structure "map" into a file'}; n=n+1; h(n).str={'FT_read_surface_map : reads data for a structure "map" from a file'}; n=n+1; h(n).str={'FT_read_virgo_map : reads a Virgo mirror map file into a structure "map"'}; n=n+1; h(n).str={'FT_plot_virgo_map : plots the map read by "FT_read_virgo_map"'}; n=n+1; h(n).str={'FT_recenter_virgo_map : computes a new center for Virgo map'}; for i=n_last:n h(i).keyword='maps '; end n_last=n+1; n=n+1; h(n).str={'FT_find_text_in_file : scans a text file for a given string'}; n=n+1; h(n).str={'FT_make_backup : makes backup from file'}; n=n+1; h(n).str={'FT_search_string_for_block_commands : searches for block begin+end in string '}; n=n+1; h(n).str={'FT_delete_file : deletes a file'}; for i=n_last:n h(i).keyword='file '; end n_last=n+1; nfunctions=n; % check if help name is a keyword keyword=0; for i=1:nkeywords if strcmp(cell2mat(keywords(i)),help_name); keyword=i; break; end end % check if help name exists in function names function_idx=[]; for i=1:nfunctions [tmp_cell,tmp_line]=strtok(cell2mat(h(i).str),':'); if strfind(tmp_cell,help_name); function_idx=[function_idx, i]; end end if (keyword==1) % if keyword is all: print all disp(sprintf('List of all functions:\n')); for i=1:nfunctions disp(sprintf('%s',cell2mat(h(i).str))); end elseif (keyword) % if help_name was a keyword print those disp(sprintf('Functions for the keyword ''%s'':\n',cell2mat(keywords(keyword)))); for i=1:nfunctions if (strfind(h(i).keyword,cell2mat(keywords(keyword)))) disp(sprintf('%s',cell2mat(h(i).str))); end end elseif (function_idx) % if help_name was NOT a keyword print functions with matching names disp(sprintf('Functions with ''%s'' in their name:\n',help_name)); for i=function_idx disp(sprintf('%s',cell2mat(h(i).str))); end else % if nothing matches, print usage print_usage(); end function []=print_usage() disp(sprintf('Usage: FT_help(help_topic)\n')); disp(sprintf('use the string "help_topic" to select a topic from the following list:\n')); disp(sprintf(' - all: lists all available function from the SimTools package')); disp(sprintf(' - example: lists example scripts')); disp(sprintf(' - parse/line: list functions for parsing text lines')); disp(sprintf(' - block: list functions for parsing text blocks')); disp(sprintf(' - comment: list functions for un-/commenting text')); disp(sprintf(' - maps: list functions related to mirror surface maps')); disp(sprintf(' - file: list functions related to handling of files')); disp(sprintf(' - kat/finesse: lists special functions to be used with Finesse')); disp(sprintf('\nIf "help_topic" string is not found in the list above, a list of')); disp(sprintf('of functions with that string in the function name is printed.')); disp(sprintf('Try for example FT_help(''file'') or FT_help(''_file'').')); disp(sprintf('You can also use a function name to print the help of the respective')); disp(sprintf('function, for example, FT_help(''FT_print_block'')\n'));
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -