Corrplot function : setup Variable name

조회 수: 3 (최근 30일)
Nicola Lisi
Nicola Lisi 2021년 12월 26일
댓글: Khanh Dang 2023년 1월 10일
I am using the function corrplot reading a matrix in one Excel file.
The first row of the Excel file contains the name of Variables that I would like to see on the left and down of the result plot.
Instead I see: Var1 Var2 .....
Please someone can help me to unserstand how to define the name of Variables on the Excel file ? Or how I can prepare a text data file ?
Thanks.
Nicola
  댓글 수: 2
Voss
Voss 2021년 12월 26일
Please share the code you are using to read the Excel file.
Nicola Lisi
Nicola Lisi 2021년 12월 27일
편집: Walter Roberson 2021년 12월 27일
Simple two lines of code:
data = xlsread("myExcelFile.xlsx");
corrplot(data);
As I wrote,the first row of Excel file contains the variable name.

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

채택된 답변

Walter Roberson
Walter Roberson 2021년 12월 27일
T = readtable("myExcelFile.xlsx");
data = table2array(T);
vars = T.Properties.VariableNames;
corrplot(data, 'varNames', vars)
  댓글 수: 1
Khanh Dang
Khanh Dang 2023년 1월 10일
Hi Walter Roberson,
Please help me how to change the fontsize and color of subplots in the correlation matrix which is plotted by corrplot function?
I need a help immediately, I am on roadblock to complete report now.
Thanks advance!

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

추가 답변 (1개)

Nicola Lisi
Nicola Lisi 2021년 12월 27일
Thanks a lot for the suggestion !!!
Regards and Happy New Year !!!

카테고리

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

제품


릴리스

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by