我有很多以以下形式标记的文件名:
test1_cvariable1_cvariable2_rvariable.csv
Run Code Online (Sandbox Code Playgroud)
为了自动加载和处理它们,我使用以下代码:
%filename
txt = ['test1_cvariable1_cvariable2_rvariable.csv']
%step 1
RNG = [23 0 1539 8];
M = csvread(txt,23,0,RNG);
Run Code Online (Sandbox Code Playgroud)
然后我想绘制一个具有相应标题的图表,但由于 matlab 如何解释下划线“_”,如果我使用:
%plot time vs variable
plot(M(:,1),M(:,8))
xlabel('Time (s)')
ylabel('Var')
title(['Var ' txt])
Run Code Online (Sandbox Code Playgroud)
在表格中给出标题
test1cvariable1cvariable2rvariable
Run Code Online (Sandbox Code Playgroud)
以 c、c 和 r 作为下标(讽刺的是,我不知道如何在这里执行此操作)
如何让Matlab不将下划线后面的字符作为下标?