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

29 views (last 30 days)
もったいないお化け
初めまして
テーブルから読み込んだ文字列を、そのままワークスペース変数名にしたいのですのがどのようにすればよろしいでしょうか?

Accepted Answer

交感神経優位なあかべぇ
Edited: 交感神経優位なあかべぇ on 14 Jul 2022
ある文字列の変数名をベースワークスペースに作成(代入)するには、assigninが使用できます。
ベースワークスペース内に、テーブルの各値の変数名を作成する場合は、下記のように実行することで、実現できます。
DCM = table(["KDHEU"; "KHTYDJDB"; "KBFUGENJ"], 'VariableNames', {'KNE'})
for idx = 1 : height(DCM)
% ベースワークスペースに、DCM.KNEの文字列の変数名を作成し、空の値を代入
assignin('base', DCM.KNE(idx), '');
end
  1 Comment
もったいないお化け
ありがとうございます!無事できました!

Sign in to comment.

More Answers (0)

Categories

Find more on table in Help Center and File Exchange

Products


Release

R2022a

Community Treasure Hunt

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

Start Hunting!