how to put title in graph

조회 수: 5 (최근 30일)
jaekeun lim
jaekeun lim 2019년 9월 6일
댓글: jaekeun lim 2019년 9월 7일
I would like to put title in each graph with original file names. However, when I try it, error message was given "You cannot subscript a table using linear indexing (one subscript) or multidimensional indexing (three or more subscripts). Use a row subscript and a variable subscript."
I could not find the solution. Could you help me?
I put core code for this question.
filelists = dir('*.txt');
file = length(filelists);
title = struct2table(filelists);
title_2 = title{:,1};
title_S = erase(title_2,".txt");
for i= 1:file
title_ind{i} = title_S{i};
h=figure;
plot(f2{i},xf{i},yf{i})
hold on
title(title_ind{i})
hold off
end

채택된 답변

Walter Roberson
Walter Roberson 2019년 9월 7일
You assigned
title = struct2table(filelists);
That creates a variable name title, which makes it difficult to use the function named title()
Do not use title as the name of a variable.
  댓글 수: 1
jaekeun lim
jaekeun lim 2019년 9월 7일
thank you so much!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Title에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by