How to plot graph from mat file?

Hi everyone, I face a difficulty in plotting graph from mat file. I want to get the graph from the mat file but the graph did not pop out and get the result in command window as shown in the figure 1 below.
Figure 1
The figure 2 below is the setting for the code.
Anyone can help me? Thanks. This is the code I am using:
clc;
clear all;
close all;
s = load('lai3.mat');
plot(transpose(s.val))

1 comentario

Steven Lord
Steven Lord el 25 de Mzo. de 2020
I recommend you change the name of your script. There is already a function named graph in MATLAB.

Iniciar sesión para comentar.

 Respuesta aceptada

Subhamoy Saha
Subhamoy Saha el 25 de Mzo. de 2020
clc;
clear all;
close all;
s = load('lai3.mat');
x=s.lai3(:,1); % s is having a field named lai3
y=s.lai3(:,2);
plot(x,y)

4 comentarios

KIEN WEI LAI
KIEN WEI LAI el 25 de Mzo. de 2020
Hi, I tried this method just now. However, the graph is still not show up, can I know what is the problem?
KIEN WEI LAI
KIEN WEI LAI el 25 de Mzo. de 2020
Hi, I have solve the problem. Thanks for your suggestion.
Subhamoy Saha
Subhamoy Saha el 25 de Mzo. de 2020
Can you tell what was the problem because I'm getting plot with the sugested line of codes.
KIEN WEI LAI
KIEN WEI LAI el 25 de Mzo. de 2020
It is the naming of my file. I put graph.mat instead of other name. That's why have the problem.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Creating, Deleting, and Querying Graphics Objects en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

el 25 de Mzo. de 2020

Comentada:

el 25 de Mzo. de 2020

Community Treasure Hunt

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

Start Hunting!

Translated by