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 サイトで参照できます。