Filter löschen
Filter löschen

A question regarding creation of .mat file

2 Ansichten (letzte 30 Tage)
Ampi
Ampi am 4 Mär. 2013
Hello,
I have a question. Say I have 5 images and I have extracted the feature vectors for each of them. Now i want save all the feature vectors in a single .mat file.I have written the following code. I want to know if the code is ok or not?
img = rgb2gray(imread('E:\1.jpeg'));
[r,c]= size(img);
h = NaN(r,c,5); %pre-allocate memory
h(:,:,1) = img;
for k=1:3
h(:,:,k) = rgb2gray(imread(sprintf('%d.jpeg',k)));
end
save h.mat

Antworten (1)

Jan
Jan am 4 Mär. 2013
You do not want to save all local variables, so I assume this is better:
save h.mat h

Kategorien

Mehr zu Workspace Variables and MAT-Files finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by