MATLABにもPythonのformat関数に似たものはありますか?
Afficher commentaires plus anciens
【やりたいこと】
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でも文字列を処理する際に似たような関数があればその使い方含めて教えてくださると幸いです。
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur 文字と文字列 dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!