# MATLAB: Have a .mat file in the Work space and i need to view the image in it

image processing

Hello , I have .mat file in the Work space which contains the Image data. I need to view the image in it. Let me know how this is done. I need to extract the image and display this image in MATLAB GUI.
Looking forward to hear from you at the earliest.
Thanks Pankaja

datastruct = load('TheFileNameHere.mat');varnames = fieldnames(datastruct);var_to_load = varnames{1};imagedata = datastruct.(var_to_load);  %pull out the data for that variableimagesc(imagedata);   %view it