フィルターのクリア

Hi, i have a .mat file and i have images in that file. i need to view the each image.

5 ビュー (過去 30 日間)
I have received one file with .mat format and i need to view the images in it. could anyone please help me?
  2 件のコメント
live to l e a r n  MATLAB
live to l e a r n MATLAB 2012 年 12 月 20 日
In .mat files having any variables name means its easy to use imshow function
Mohan Prasath Thirumalaisamy
Mohan Prasath Thirumalaisamy 2012 年 12 月 20 日
編集済み: Walter Roberson 2015 年 6 月 29 日
Hi Kesavan,
>> load('data.mat')
>> open('data.mat')
ans =
testdata: [1x67 struct]
this is what i am getting and i want to view the images.
The variable name is testdata as far as i understood and even if i give, it shows me error.

サインインしてコメントする。

採用された回答

Jan
Jan 2012 年 12 月 28 日
The reply "testdata = 1x67 struct array" reveals, that a struct array is replied. So please try:
storedStructure = load(fullMatFileName)
for ii = 1:numel(storedStructure)
figure; % Open a new figure
image(storedStructure(ii).image);
end
  5 件のコメント
Image Analyst
Image Analyst 2018 年 6 月 15 日
It does not matter. If there is no field of the structure "storedStructure" called "image" then the reference to storedStructure(ii).image will fail.
I suspect you have different code, a different mat file, a different question, and should have asked this in your own discussion thread.
Walter Roberson
Walter Roberson 2018 年 6 月 15 日
image() works under the following circumstances:
  • data is uint8, uint16, uint32, uint64
  • data is int8, int16, int32, int64
  • data is single, double
  • data is logical
  • data is 2D array
  • data is 3D array with length of third dimension is 3
image() does not work under the following circumstances
  • data is char, string, cell array, struct, graphics object
  • data has complex components, even if the components are all 0
image() does not normally work for objects (in the object-oriented sense), but it is not out of the question that the designers of the object might have created an image() method

サインインしてコメントする。

その他の回答 (2 件)

Image Analyst
Image Analyst 2012 年 12 月 20 日
storedStructure = load(fullMatFileName);
image1 = storedStructure.image1; % or whatever it's called.
image2 = storedStructure.image2; % or whatever it's called.
image3 = storedStructure.image3; % or whatever it's called.
imshow(image1, []);
imshow(image2, []);
imshow(image3, []);
  8 件のコメント
Shaveta Arora
Shaveta Arora 2015 年 6 月 29 日
Mr. Mohan
Can u pls help me in this, my .mat file contains only one image. how to read that?
Image Analyst
Image Analyst 2015 年 6 月 29 日
Use the load() function. But you saw my answer so I'm not sure why it's not working for you. What went wrong?

サインインしてコメントする。


Ricky Moua
Ricky Moua 2019 年 6 月 14 日
I"m getting this error:
>>image1 = storedStructure.image1;
Reference to non-existing field 'image1'
why?
  8 件のコメント
Image Analyst
Image Analyst 2019 年 6 月 14 日
You need to initialize frame counter somewhere of course. Did you do that? Do that before your loop starts. You might call getsnapshot() instead of getdata().
Ricky Moua
Ricky Moua 2019 年 6 月 17 日
Enclosed is the complete script. I'm getting an error "A timeout occurrred during GETSNAPSHOT".
I want the script to take an image whenever the hardware is being trigged and I only want 5 images for now.

サインインしてコメントする。

Community Treasure Hunt

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

Start Hunting!

Translated by