How to open a .mat file in Matlab

1.332 visualizaciones (últimos 30 días)
Priya
Priya el 27 de Mzo. de 2014
Editada: Walter Roberson el 25 de Nov. de 2024 a las 18:29
Hi,
I'm trying to open a .mat file in Matlab, but am unble to do it. I followed the instructions from this link below,
After step 6, I have a separate folder for 'R2012B', now what should I select from this folder.Please let me know your suggestions.
  6 comentarios
Joaquin
Joaquin el 25 de Nov. de 2024 a las 15:46
doesn't show anything, it gives me an error
Error using imageDisplayValidateParams
Expected input number 1, I, to be one of these types:
double, single, uint8, uint16, uint32, uint64, int8, int16, int32,
int64, logical
Instead its type was struct.
Error in images.internal.imageDisplayValidateParams (line 11)
validateattributes(common_args.CData, {'numeric','logical'},...
Error in images.internal.imageDisplayParseInputs (line 79)
common_args = images.internal.imageDisplayValidateParams(common_args);
Error in imshow (line 253)
images.internal.imageDisplayParseInputs({'Parent','Border','Reduce'},preparsed_varargin{:});
Error in Base_Lab_estudiantes (line 2)
imshow(a)
Stephen23
Stephen23 el 25 de Nov. de 2024 a las 15:56
Editada: Stephen23 el 25 de Nov. de 2024 a las 16:14
@Joaquin: the comment given by Areej Nayab will not work, because LOAD returns a structure (with one field of each variable in the MAT file). However, IMSHOW does not accept a structure as its input. The error message states what inputs types it accepts.
You will need to know the fieldname and refer to that, e.g.:
S = load(..)
imshow(S.YourFieldnameHere)
See:

Iniciar sesión para comentar.

Respuestas (3)

Image Analyst
Image Analyst el 27 de Mzo. de 2014
Spcify the full path of your file
folder = 'c:\whatever........'; % You specify this!
fullMatFileName = fullfile(folder, 'wheel_rail_AW.mat')
if ~exist(fullMatFileName, 'file')
message = sprintf('%s does not exist', fullMatFileName);
uiwait(warndlg(message));
else
s = load(fullMatFileName);
end

smriti garg
smriti garg el 28 de Mzo. de 2015
Editada: Walter Roberson el 25 de Nov. de 2024 a las 18:29
I just got a more user-friendly way of selecting a *.mat file, so thought to share:
[fileName,filePath] = uigetfile('*', 'Select data file', '.');
if filePath==0, error('None selected!');
end
U = load( fullfile(filePath,fileName) );
enjoy!!

abdelilah mbarek
abdelilah mbarek el 9 de Jun. de 2018
use :
whos -file fileName.mat
fileName.mat should be in matlab path
  1 comentario
Walter Roberson
Walter Roberson el 9 de Jun. de 2018
That could tell you which variables are in the file, but does not load the data from the file.

Iniciar sesión para comentar.

Categorías

Más información sobre File Operations en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by