Main Content

cdflib.renameAttr

属性名を変更します。

構文

cdflib.renameAttr(cdfId,attrNum,newName)

説明

cdflib.renameAttr(cdfId,attrNum,newName) は、CDF (Common Data Format) ファイルの属性の名前を変更します。

cdfId は CDF ファイルを識別します。attrNum は、属性を識別する数値です。属性番号は 0 ベースです。newName は、属性に割り当てる名前を指定する文字ベクトルまたは string スカラーです。

CDF を作成し、CDF に属性を作成したら、属性の名前を変更します。この例を実行するためには、書き込み可能なフォルダーに移動します。

cdfId = cdflib.create("your_file.cdf");

% Create an attribute
attrNum = cdflib.createAttr(cdfId,"Purpose","global_scope");
% Check the name of the attribute
attrName = cdflib.getAttrName(cdfId,attrNum)
attrName =

    'Purpose'
% Rename the attribute
cdflib.renameAttr(cdfId,attrNum,"NewPurpose")

% Check the new name of the attribute
attrName = cdflib.getAttrName(cdfId,attrNum)
attrName =

    'NewPurpose'
% Clean up
cdflib.delete(cdfId)
clear cdfId

参照

この関数は、CDF ライブラリ C API のルーチン CDFrenameAttr に相当します。

この関数を使用するには、CDF C インターフェイスに関する知識を必要とします。CDF のドキュメンテーションは CDF の Web サイトで参照できます。