필터 지우기
필터 지우기

How to create a GUI in matlab?

조회 수: 2 (최근 30일)
Harry Smith
Harry Smith 2022년 9월 13일
댓글: Harry Smith 2022년 9월 15일
Hello everybody,
i am not very experienced in matlab.
I have to create a GUI that a gui that should make me enter:
input: a file (of any extension) and the numerical values of some variables (ex: x coordinates, y coordinates, size_map)
output: an .hdr file that contains these numeric values associated with the input file
i'm using gdal in matlab
How can I do?
  댓글 수: 4
Image Analyst
Image Analyst 2022년 9월 13일
Sounds like you totally overlooked or ignored my answer below. Why?
Harry Smith
Harry Smith 2022년 9월 13일
I'm sorry, I answered you

댓글을 달려면 로그인하십시오.

답변 (1개)

Image Analyst
Image Analyst 2022년 9월 13일
You forgot to attach your input file, probably because you never read the community guidelines or this link:
So if the file is a binary image, you can do
mask = imread(filename);
[rows, columns] = find(mask);
x_min = min(columns);
x_max = max(columns);
y_min = min(rows);
y_max = max(rows);
To get the pixel size you're going to have to get that somehow, like from spatial calibration or the header of the image. Otherwise, any spatial analysis will just give you results in pixels, which really doesn't have a size, or maybe you just want to consider it as 1. But if you want real world units, you have to calibrate like shown in my attached demo.
  댓글 수: 9
Image Analyst
Image Analyst 2022년 9월 15일
It should be. Write a small demo that proves this to me. Here are the steps you should do:
% Read your existing table.
t = readtable(filename)
% Now alter one field to have a different value.
t.Whatever(1) = someNewValue;
% Now call write table and save to a different text file.
filename2 = 'answers.txt'
writetable(t, filename2)
Then attach the code and both text files with the paperclip icon.
Harry Smith
Harry Smith 2022년 9월 15일
In this case it works, but I would like to be able to change the values at the graphical interface, not at the code level.
I attach the input file and my code:
file='fileinput.txt';
table_filetxt=readtable(fileinput);
fig = uifigure;
uit = uitable(fig,'Data',table_filetxt);
uit = uitable(fig);
uit.Data = table_filetxt;
uit.ColumnSortable = true;
uit.ColumnEditable = [false true true true];
fileinput2='fileinput2.txt'
writetable(table_filetxt,'fileinput2.txt');
A window opens with my table, I can modify the values, but not save it.
Instead, if you opened the table via workspace and changed the values, in that case it would save them.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Interactive Control and Callbacks에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by