How do you delete and space characters in Matlab Virtual Keyboard ?

조회 수: 6 (최근 30일)
Jeremy Tsang
Jeremy Tsang 2021년 3월 15일
댓글: Uday Pradhan 2021년 3월 22일
We are having trouble deleting and spacing characters in our Matlab virtual keyboard. When we want to press delete, the word delete appears in the keyboard instead of actually deleting characters. When we want to space out the characters in Matlab, the word space appears in the matlab code instead of actually spacing out the characters.

답변 (1개)

Uday Pradhan
Uday Pradhan 2021년 3월 19일
편집: Uday Pradhan 2021년 3월 19일
Hi,
Just a naive try at what you asked, i hope it helps!
function AddLetter(letter)
%Called when letter pressed
%Add letter to string
str = get(hEdit,'string');
if strcmp(letter,'SPACE')
str(end+1) = ' ';
elseif strcmp(letter,'DELETE')
str(end) = '';
else
str = horzcat(str,letter);
end
set(hEdit,'string',str);
drawnow;
%NOTE: Obviously, you'll need to add features here such as
%backspace etc.
end
  댓글 수: 2
Jeremy Tsang
Jeremy Tsang 2021년 3월 20일
Hi there. The delete feature does not work. Any advice on how to get that part to work ?
Uday Pradhan
Uday Pradhan 2021년 3월 22일
On my end, It works like a backspace key. I have just used the following logic:
>> str = 'hello world';
>> str(end) = '' %empty quote
str =
'hello worl'

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

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by