Extract values from a fig file?
조회 수: 12 (최근 30일)
이전 댓글 표시
Hi, I have a file like "Example.fig" that contains a picture
and I want to extract the values of each pixel and put them in a matrix form so I can work with them
What can I do?
댓글 수: 0
채택된 답변
Star Strider
2023년 6월 8일
Try this —
F = openfig('Example.fig'); % Load File & Display Contents
Ax = gca; % Get Axis Handle
Fmtx = Ax.Children.CData % Get Image Data
figure
surf(Fmtx) % Plot Image Data As 'surf'
colormap(turbo)
set(gca, 'YDir','reverse')
view(-30, 60)
title('Recovered Data Matrix')
.
댓글 수: 0
추가 답변 (1개)
Vinayak Agrawal
2023년 6월 9일
Hi MementoMori,
According to me these commands will help you get the results
>>s=load('Example.fig','-mat'); %opening the figure
>> values=s.hgS_070000.children(1).children.properties.CData; %storing pixel values
>> fig = imagesc(values); %verifying by plotting the ‘values’ which are our pixel values
You can see the pixel values by double clicking on ‘values’ variable created in your workspace
You can refer to these documents also-
- extracting data series from *.fig file - MATLAB Answers - MATLAB Central (mathworks.com)
- matlab - plot matrices in desired colors - Stack Overflow
Hope it helps!
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Specifying Target for Graphics Output에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!