How to read the size of a mat file?

Asked

Viewed 133 times

1

I have a mat file with certain data. It has 10 rows per 500 columns but when I do:

matriz = load('Planilha.mat');
disp(size(matriz));

The result is 1 by 20. Which is totally different from the expected.

How do I get the correct file size .mat ?

  • What is the file format? Describe an example in the question.

  • @Marcelo Uchimura, the file format is '.mat', file with numerical data.

  • Are you sure you saved the right matrix inside the file?

  • Yes, through Matlab’s Workspace to visualize the matrix.

2 answers

2


Besides Marcelo Uchimura put in the answer, It is worth remembering that when you use

matrix=load('data.mat') 

or

matrix=load('data.mat','variavel')

You have as answer a structure, not the saved Matrix. Assuming the flame Matrix mt, to access it is necessary to use

st=load('data.mat')
matrix=st.mt

or just use

load('data.mat') 

or

load('data.mat','variavel')

This will put the matrix in Workspace, the way you want it.

0

Inspect the variables saved within the . mat with

whos -file Planilha.mat

Then, to load the variable you need, do

matriz = load('Planilha.mat','nomedavariavel')

Source: here

  • 2

    In fact this generates a structure.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.