Join two sprintf into one and show it on static field

조회 수: 6 (최근 30일)
Soveatin Kuntur
Soveatin Kuntur 2021년 5월 13일
답변: Fangjun Jiang 2021년 5월 13일
I want my program show something like this : Not stable. cycle of length 2 and between vector A and B
but its only show and vector B
elseif(out_firstprime==previoussecond)
fmt = ['Not stable cycle of length 2 between : [', repmat('%g, ', 1, numel(out_firstprime)-1), '%g]^T\n'];
%fprintf(fmt, out_firstprime)
set(handles.text3, 'string', sprintf(fmt, out_firstprime));
fmt = ['and [', repmat('%g, ', 1, numel(previousfirst)-1), '%g]^T\n'];
set(handles.text3, 'string', sprintf(fmt, previousfirst));
%fprintf(fmt, previousfirst)

답변 (1개)

Fangjun Jiang
Fangjun Jiang 2021년 5월 13일
The second set(handles.text3, 'string',...) will over-write the first one. You need to combine the string and run set() once.
Also, the format is overly complicated. Please provide an example of A and B, specify the desired string. There might be easier and better way to do it.

카테고리

Help CenterFile Exchange에서 Migrate GUIDE Apps에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by