plotting .mat file

조회 수: 1 (최근 30일)
Raheema Syed
Raheema Syed 2019년 2월 20일
댓글: Yasasvi Harish Kumar 2019년 2월 20일
I have three .mat files, 'total_cost1.mat', 'total_cost2.mat' and 'total_cost.mat' . Each of the file contains one number, like total_cost1.mat contains 5.3142e+04, total_cost2.mat contains 5.3361e+04 and total_cost.mat contains 6.9351e+04 value. I need to plot these 3 values in one graph where i need to name the 1st number 'a', 2nd number 'b' and 3rd value 'c' in x axis.
How is this bar plotting done.
  댓글 수: 1
Yasasvi Harish Kumar
Yasasvi Harish Kumar 2019년 2월 20일
What do you want to plot them against?
Try using load('total_cost1.mat') to be able to access the data.

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

답변 (1개)

KSSV
KSSV 2019년 2월 20일
a = 5.3142e+04 ;
b = 5.3361e+04 ;
c = 6.9351e+04 ;
x = {'a','b','c'} ;
y = [a b c] ;
bar(y)
set(gca,'xtick',1:3);
set(gca,'xticklabel',x);

카테고리

Help CenterFile Exchange에서 Creating, Deleting, and Querying Graphics Objects에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by