MATLABにもPythonのformat関数に似たものはありますか?
이전 댓글 표시
【やりたいこと】
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でも文字列を処理する際に似たような関数があればその使い方含めて教えてくださると幸いです。
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 文字と文字列에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!