文字ベクトルを変換する
8 views (last 30 days)
Show older comments
現在、以下の状況です。
A=1200行×3列のtable形式
B=’C’の文字ベクトル
この状況から、C=A[1200行×3列のtable]となるようにしたいのですが、どのようにすべきでしょうか。
0 Comments
Accepted Answer
交感神経優位なあかべぇ
on 15 Dec 2022
変数Bの中の文字列を変数名として格納したいということでしょうか?
少し強引な気がしますが、assigninを無名関数から呼び出してみました。(変数Cをベースワークスペースに保存する用途でしたら、assignin('base' でスマートに実装ができます。)
testFcn();
function testFcn();
tableData = num2cell(zeros(1200, 3), 1);
A = table(tableData{:});
B = 'C';
fcnHdl = @() assignin('caller', B, A);
fcnHdl();
C % 変数Cの内容の確認
end
More Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!