App designer Edit field, position

조회 수: 5 (최근 30일)
Eliska Paulikova
Eliska Paulikova 2023년 3월 17일
댓글: Voss 2023년 3월 19일
thisFrame = read(vid, framesToRead(h));
pos1=app.CTRLVEditField.Value
str = strrep(pos1, '[', ''); % Odstranění závorek
str = strrep(str, ']', '');
values= split(str, ','); % Rozdělení řetězce podle čárky
pos = str2double(pos1) % Převod na čísla
cr=imcrop(thisFrame,pos);
Hello, I work in App designer, where I put into Edit filed the area I would like to crop in this type [1 2 3 4], but in the position cr=imcrop ... the matlab says
Input number 2, RECT, is expected to contain 4 elements.
validateRectangle(spatial_rect,2);
Error in imcrop (line 104)
images.internal.crop.parseInputsOverTwo(varargin{:});
How can I solve this problem. Thank you.

채택된 답변

Voss
Voss 2023년 3월 17일
pos1 = "[1 2 3 4]";
pos = str2num(pos1)
pos = 1×4
1 2 3 4
  댓글 수: 2
Eliska Paulikova
Eliska Paulikova 2023년 3월 18일
Thank you
Voss
Voss 2023년 3월 19일
You're welcome!

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Simulink에 대해 자세히 알아보기

태그

제품


릴리스

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by