Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Error message with imread and imshow

Subject: Error message with imread and imshow

From: Arie Driga

Date: 13 Feb, 2010 08:30:22

Message: 1 of 6

Hi!

I tried to read and present a picture in matlab. The picture itself was created using adobe illustrator and then I saved it in tif format.

When I tried to use 'imread', the following error message appears:
>> imread(Calculation_1.tif)
??? Attempt to reference field of non-structure array

And when I tried to directly use imshow, the following error message appears:
>> imshow(Calculation_1.tif)
??? Attempt to reference field of non-structure array.

What has gone wrong here?
The picture is quite big, the size is 3617x2329
But, I did tried to cut the picture and re-save it using paint, and still the same error messages appear.

Subject: Error message with imread and imshow

From: Thomas Clark

Date: 13 Feb, 2010 10:37:20

Message: 2 of 6

Arie,

You need to specify the filename as a string:
A = imread('Calculation_1.tif');
% OR
filename = 'Calculation_1.tif';
A = imread(filename);

Without the quotation marks, matlab thinks that Calculation_1 is the name of a variable, which could contain the filename (as in the second example above) - but of course the variable Calculation_1 doesn't exist.

In this case, the error message was complicated by the fact that the .tif was present - it made Matlab think that the filename was stored in a data type called a structure, which uses the . notation to group variables together.

Hope this helps

Tom C

"Arie Driga" <a_driga@yahoo.com> wrote in message <hl5nuu$i0k$1@fred.mathworks.com>...
> Hi!
>
> I tried to read and present a picture in matlab. The picture itself was created using adobe illustrator and then I saved it in tif format.
>
> When I tried to use 'imread', the following error message appears:
> >> imread(Calculation_1.tif)
> ??? Attempt to reference field of non-structure array
>
> And when I tried to directly use imshow, the following error message appears:
> >> imshow(Calculation_1.tif)
> ??? Attempt to reference field of non-structure array.
>
> What has gone wrong here?
> The picture is quite big, the size is 3617x2329
> But, I did tried to cut the picture and re-save it using paint, and still the same error messages appear.

Subject: Error message with imread and imshow

From: Arie Driga

Date: 13 Feb, 2010 11:10:14

Message: 3 of 6

"Arie Driga" <a_driga@yahoo.com> wrote in message <hl5nuu$i0k$1@fred.mathworks.com>...
> Hi!
>
> I tried to read and present a picture in matlab. The picture itself was created using adobe illustrator and then I saved it in tif format.
>
> When I tried to use 'imread', the following error message appears:
> >> imread(Calculation_1.tif)
> ??? Attempt to reference field of non-structure array
>
> And when I tried to directly use imshow, the following error message appears:
> >> imshow(Calculation_1.tif)
> ??? Attempt to reference field of non-structure array.
>
> What has gone wrong here?
> The picture is quite big, the size is 3617x2329
> But, I did tried to cut the picture and re-save it using paint, and still the same error messages appear.

Thanks Tom!

It appears there is something wrong which I do not know.
I did try with what you told me, but it say that the file could not be found.
I restarted my matlab, and now it works.
But the problem has been solved now!

Subject: Error message with imread and imshow

From: ImageAnalyst

Date: 13 Feb, 2010 12:44:18

Message: 4 of 6

The image wasn't in your current folder or your path. In that case
you'd need to supply the full path name of the file.

Subject: Error message with imread and imshow

From: Nathan

Date: 15 Feb, 2010 21:37:15

Message: 5 of 6

On Feb 13, 3:10 am, "Arie Driga" <a_dr...@yahoo.com> wrote:
> "Arie Driga" <a_dr...@yahoo.com> wrote in message <hl5nuu$i0...@fred.mathworks.com>...
> > Hi!
>
> > I tried to read and present a picture in matlab. The picture itself was created using adobe illustrator and then I saved it in tif format.
>
> > When I tried to use 'imread', the following error message appears:
> > >> imread(Calculation_1.tif)
> > ??? Attempt to reference field of non-structure array
>
> > And when I tried to directly use imshow, the following error message appears:
> > >> imshow(Calculation_1.tif)
> > ??? Attempt to reference field of non-structure array.
>
> > What has gone wrong here?
> > The picture is quite big, the size is 3617x2329
> > But, I did tried to cut the picture and re-save it using paint, and still the same error messages appear.
>
> Thanks Tom!
>
> It appears there is something wrong which I do not know.
> I did try with what you told me, but it say that the file could not be found.
> I restarted my matlab, and now it works.
> But the problem has been solved now!

For future reference, please don't double post.
I answered your question in your first posting:
http://www.mathworks.com/matlabcentral/newsreader/view_thread/273631#717341

-Nathan

Subject: Error message with imread and imshow

From: Arie Driga

Date: 15 Feb, 2010 22:00:21

Message: 6 of 6

Nathan <ngreco32@gmail.com> wrote in message <5de2a538-e3f7-4371-8e9f-c7ad5ec09f1d@u15g2000prd.googlegroups.com>...
> On Feb 13, 3:10 am, "Arie Driga" <a_dr...@yahoo.com> wrote:
> > "Arie Driga" <a_dr...@yahoo.com> wrote in message <hl5nuu$i0...@fred.mathworks.com>...
> > > Hi!
> >
> > > I tried to read and present a picture in matlab. The picture itself was created using adobe illustrator and then I saved it in tif format.
> >
> > > When I tried to use 'imread', the following error message appears:
> > > >> imread(Calculation_1.tif)
> > > ??? Attempt to reference field of non-structure array
> >
> > > And when I tried to directly use imshow, the following error message appears:
> > > >> imshow(Calculation_1.tif)
> > > ??? Attempt to reference field of non-structure array.
> >
> > > What has gone wrong here?
> > > The picture is quite big, the size is 3617x2329
> > > But, I did tried to cut the picture and re-save it using paint, and still the same error messages appear.
> >
> > Thanks Tom!
> >
> > It appears there is something wrong which I do not know.
> > I did try with what you told me, but it say that the file could not be found.
> > I restarted my matlab, and now it works.
> > But the problem has been solved now!
>
> For future reference, please don't double post.
> I answered your question in your first posting:
> http://www.mathworks.com/matlabcentral/newsreader/view_thread/273631#717341
>
> -Nathan

Hi Nathan,

I did not realize that I made double post for this topic.
Thanks for reminding me.

Tags for this Thread

No tags are associated with this thread.

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us