필터 지우기
필터 지우기

plot data from .mat file

조회 수: 8 (최근 30일)
akriti
akriti 2024년 2월 16일
편집: Askic V 2024년 2월 16일
Hello,
I have some 649x1 double data saved in "Fidelity_result.mat" file from a matlab code. I want to plot these data as y axis and x axis should be entries from 1 to length of the entries in "Fidelity_result.mat" file. The matlab code shows no error but the figure displayed at the end is blank.
folder = 'C:\Users\Laborbenutzer\Desktop\Tomography Test Akriti';
y=load("Fidelity_result.mat");
y_fidelity=y.Fidelity_result;
x_fidelity=(1:1:size(y_fidelity,1)).';
plot(x_fidelity,y_fidelity)
  댓글 수: 2
Stephen23
Stephen23 2024년 2월 16일
Please upload your MAT file by clicking the paperclip button.
Dyuman Joshi
Dyuman Joshi 2024년 2월 16일
The plot is not blank here, see below.
"The matlab code shows no error but the figure displayed at the end is blank."
Could you share the screenshot of the code ran along with the screenshot of the figure generated?
y=load("Fidelity_result.mat");
y_fidelity=y.Fidelity_result;
x_fidelity=(1:1:size(y_fidelity,1)).';
plot(x_fidelity,y_fidelity)
Also, if you want to plot against indices, you can plot it directly -
figure
plot(y_fidelity)

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

답변 (1개)

Askic V
Askic V 2024년 2월 16일
편집: Askic V 2024년 2월 16일
I would do it like this:
load (websave('Fidelity_result.mat', 'https://www.mathworks.com/matlabcentral/answers/uploaded_files/1618953/Fidelity_result.mat'))
x = 1:numel(Fidelity_result);
plot(x, Fidelity_result)

카테고리

Help CenterFile Exchange에서 Migrate GUIDE Apps에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by