App designer Edit field, position

6 visualizaciones (últimos 30 días)
Eliska Paulikova
Eliska Paulikova el 17 de Mzo. de 2023
Comentada: Voss el 19 de Mzo. de 2023
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.

Respuesta aceptada

Voss
Voss el 17 de Mzo. de 2023
pos1 = "[1 2 3 4]";
pos = str2num(pos1)
pos = 1×4
1 2 3 4
  2 comentarios
Eliska Paulikova
Eliska Paulikova el 18 de Mzo. de 2023
Thank you
Voss
Voss el 19 de Mzo. de 2023
You're welcome!

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Simulink en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by