Opening .mat file using matlab

26 views (last 30 days)
Kilaliba Tugwell
Kilaliba Tugwell on 22 Jun 2023
Answered: Image Analyst on 23 Jun 2023
I couldn’t open a .mat file in my computer using matlab. Rather it was opening with Microsoft Access and I followed the laid down procedures on how to change the default file type. But the thing is that I didn’t find .mat extension in my file type. What do I do?
  4 Comments
Mayur
Mayur on 22 Jun 2023
Can you share a screenshot of the file properties?

Sign in to comment.

Answers (2)

Mayur
Mayur on 23 Jun 2023
Moved: Image Analyst on 23 Jun 2023
Thanks for sharing that. If you open MATLAB and then open this file from there, does it open properly?
Also, please check the following MATLAB Answers in case they help:
  1 Comment
Kilaliba Tugwell
Kilaliba Tugwell on 23 Jun 2023
Moved: Image Analyst on 23 Jun 2023

I tried opening it from the MATLAB software and it worked.

Thank you Mayur🙏🏽

Sign in to comment.


Image Analyst
Image Analyst on 23 Jun 2023
Try
storedStructure = load('C:\Users\X360\Desktop\My Thesis\third trial')
All the variables stored in that mat file will be fields of the structure returned by the load function.
help load
LOAD Load data from MAT-file into workspace. S = LOAD(FILENAME) loads the variables from a MAT-file into a structure array, or data from an ASCII file into a double-precision array. Specify FILENAME as a character vector or a string scalar. For example, specify FILENAME as 'myFile.mat' or "myFile.mat". S = LOAD(FILENAME, VARIABLES) loads only the specified variables from a MAT-file. Specify FILENAME and VARIABLES as character vectors or string scalars. When specifying VARIABLES, use one of the following forms: VAR1, VAR2, ... Load the listed variables. Use the '*' wildcard to match patterns. For example, load('A*') loads all variables that start with A. '-regexp', EXPRESSIONS Load only the variables that match the specified regular expressions. For more information on regular expressions, type "doc regexp" at the command prompt. S = LOAD(FILENAME, '-mat', VARIABLES) forces LOAD to treat the file as a MAT-file, regardless of the extension. Specifying VARIABLES is optional. S = LOAD(FILENAME, '-ascii') forces LOAD to treat the file as an ASCII file, regardless of the extension. LOAD(...) loads without combining MAT-file variables into a structure array. LOAD ... is the command form of the syntax, for convenient loading from the command line. With command syntax, you do not need to enclose inputs in single or double quotation marks. Separate inputs with spaces instead of commas. Do not use command syntax if FILENAME is a variable. Notes: If you do not specify FILENAME, the LOAD function searches for a file named matlab.mat. ASCII files must contain a rectangular table of numbers, with an equal number of elements in each row. The file delimiter (character between each element in a row) can be a blank, comma, semicolon, or tab. The file can contain MATLAB comments. Examples: gongStruct = load('gong.mat') % All variables load('handel.mat', 'y') % Only variable y load('accidents.mat', 'hwy*') % Variables starting with "hwy" load('topo.mat', '-regexp', '\d') % Variables containing digits % Using command form load gong.mat load topo.mat -regexp \d load 'hypothetical file.mat' % Filename with spaces See also SAVE, MATFILE, WHOS, CLEAR, REGEXP, IMPORTDATA, UIIMPORT. Documentation for load doc load Other uses of load Aero.Body/load coder/load COM.com/load COM/load controllib.widget.internal.cstprefs.ToolboxPreferences/load driving/load icomm/load imaq/load instrument/load matlab.buildtool.Plan/load matlab.diagram.ClassViewer/load mlreportgen.utils.word/load parallel.Job/load sim3d.Actor/load Simulink.CodeImporter/load Simulink.sdi/load slrealtime.Target/load slreq/load sltest.harness/load sltest.testmanager/load

Tags

Community Treasure Hunt

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

Start Hunting!