Compare strings and indicate differences by color in GUI

Hi all,
I haven't been able to find a solution to the following: I would like to compare two strings and show the differences between them in AppDesigner through changing color of the letters that differ.
Does someone know if this is possible and how to do it?

댓글 수: 4

Adam Danz
Adam Danz 2019년 9월 27일
편집: Adam Danz 2019년 9월 27일
There are lots of solutions. Browse the documentation and look at the examples for some of these ideas below.
  • strcmp / strcmpi
  • contains
  • strfind
  • regexp
  • ismember
it is possible. how you gui code looks like?
I currently have a text field where the user can add a nucleotide sequence (DNA) and underneath I would like to have a field where the nucleotide sequence output of the program shows. In this I would like to have different colors for individual letters.
Changing colors wtihin a string is typically done with a tex interpreter. Unfortunately there is no interpreter property of GUI textboxes.
You'll need to print the string on an object that has an interpreter property like an axis or an annotation object. Here's an example.
fh = figure();
str = ['\fontsize{16}black {\color{magenta}magenta ','\color[rgb]{0 .5 .5}teal \color{red}red} black again'];
annotation(fh,'textbox','String',str, 'FontSize',25,'Interpreter','Tex');

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

답변 (0개)

카테고리

도움말 센터File Exchange에서 App Building에 대해 자세히 알아보기

제품

질문:

2019년 9월 27일

편집:

2019년 9월 27일

Community Treasure Hunt

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

Start Hunting!

Translated by