MATLABにもPythonのformat関数に似たものはありますか?
Show older comments
【やりたいこと】
MATLABでcsvファイルを読み込む際、'A_gait.csv', 'B_gait.csv', 'C_gait.csv', ...のように似たようなファイル名で管理しているため、A、B、Cのところだけを変更して簡単に処理できるようにしたいと思っています。以前Pythonを使用していたときは、format関数があったため、以下のように処理することができました。
name = {'A', 'B', 'C'};
data = readmatrix('A_gait.csv'); % この形式ではなく、
data = readmatrix('{}_gait.csv'.format(name));% このような形式で表したい
% Pythonのformat関数一例
a = 123
b = 'abc'
print('{} and {}'.format(a, b))
%ans = 123 and abc
MATLABでも文字列を処理する際に似たような関数があればその使い方含めて教えてくださると幸いです。
Accepted Answer
More Answers (0)
Categories
Find more on 文字と文字列 in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!