cdflib.renameVar
既存の変数の名前の変更
構文
cdflib.renameVar(cdfId,varNum,newName)
説明
cdflib.renameVar(cdfId,varNum,newName)
は、CDF (Common Data Format) ファイルの変数の名前を変更します。
cdfId
は CDF ファイルを識別します。varNum
は、変数を識別する数値です。変数番号は 0 ベースです。newName
は、変数に割り当てる名前を指定する文字ベクトルまたは string スカラーです。
例
CDF を作成し、CDF に変数を作成したら、変数の名前を変更します。この例を実行するためには、書き込み可能なフォルダーに移動します。
cdfid = cdflib.create('your_file.cdf'); % Create a variable in the file. varNum = cdflib.createVar(cdfid,'Time','cdf_int1',1,[],true,[]); % Get the name of the variable. name = cdflib.getVarName(cdfid,varNum) name = Time % Rename the variable cdflib.renameVar(cdfid,varNum,'NewName'); % Check the new name. name = cdflib.getVarName(cdfid,varNum) name = NewName % Clean up cdflib.delete(cdfid) clear cdfid
参照
この関数は、CDF ライブラリ C API のルーチン CDFrenamezVar
に相当します。
この関数を使用するには、CDF C インターフェイスに関する知識を必要とします。CDF のドキュメンテーションは CDF の Web サイトで参照できます。