テーブルから読み込ん​だ文字列をワークスペ​ース変数名として活用​する方法について

初めまして
テーブルから読み込んだ文字列を、そのままワークスペース変数名にしたいのですのがどのようにすればよろしいでしょうか?

 Risposta accettata

交感神経優位なあかべぇ
Modificato: 交感神経優位なあかべぇ il 14 Lug 2022

1 voto

ある文字列の変数名をベースワークスペースに作成(代入)するには、assigninが使用できます。
ベースワークスペース内に、テーブルの各値の変数名を作成する場合は、下記のように実行することで、実現できます。
DCM = table(["KDHEU"; "KHTYDJDB"; "KBFUGENJ"], 'VariableNames', {'KNE'})
for idx = 1 : height(DCM)
% ベースワークスペースに、DCM.KNEの文字列の変数名を作成し、空の値を代入
assignin('base', DCM.KNE(idx), '');
end

1 Commento

ありがとうございます!無事できました!

Accedi per commentare.

Più risposte (0)

Prodotti

Release

R2022a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!