I can't load the lighthouse.mat image
4 次查看(过去 30 天)
显示 更早的评论
% Load the lighthouse image
load('lighthouse.mat');
% Display the original image
figure;
imshow(ww);
title('Original Lighthouse Image');
%Down-sample the image by factor of 2
p=2;
wp=ww(1:p:end, 1:p:end);
% Display the downsampled image
figure;
imshow(wp);
title(['Downsampled Image by a Factor of', num2str(p)])
error:
Error using load
Unable to find file or directory 'lighthouse.mat'.
Error in untitled5 (line 2)
load('lighthouse.mat');
2 个评论
回答(2 个)
Venkat Siddarth Reddy
2024-10-12
Hi Richard,
It seems that the MATLAB is unable to find the "lighthouse" MAT file in its search path.
To resolve this issue, please make sure, either the file is in the current working directory or the file location is added to the MATLAB search path.
To learn more about adding a file location to MATLAB search path, please refer to the following documentation:
I hope it helps!
0 个评论
DGM
2024-10-13
编辑:DGM
2024-10-13
I found this one (attached), but I can't be sure if it's the right one. I have to wonder, since it seems that you're expecting the file to contain a variable "ww", whereas Walter's thread expects the file to contain a variable "lighthouse". This one contains an array called "xx".
load lighthouse.mat
imshow(xx)
EDIT: This particular mat-file was saved in 2002 and appears to contain the same image (i.e. same photo content and array size/class) as some of the assignment summaries I've seen. I'm pretty sure this is a standard image, as I've seen it around. Even if there are mat-files with different variable names, this is probably equivalent.
Otherwise, you're probably supposed to download the file from somewhere associated with the book or online resource you're using.
0 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!