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 日

0 投票

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 件)

カテゴリ

ヘルプ センター および File ExchangeDevelop Apps Using App Designer についてさらに検索

製品

リリース

R2022b

タグ

質問済み:

2023 年 3 月 17 日

コメント済み:

2023 年 3 月 19 日

Community Treasure Hunt

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

Start Hunting!

Translated by