How to print Value in next line of Table in App desiginer

2 Ansichten (letzte 30 Tage)
Med Future
Med Future am 26 Dez. 2022
Bearbeitet: Adam Danz am 29 Dez. 2022
Hello, I hope you are doing well. I have used the sprintf as follow But it does not go to the next file all character are in single row/line when I print it on Table in app designer
pred11= sprintf('\n Class 1 Butterfly Levels: %d\n\n\n Class 1 Butterfly DValue: [%s]\nMaximum Value of Butterfly:%d\nMinimum Value Butterfly :%d\n',...
T.Levels, join(string(unique(T.DValue)),' '), T.Dmaximum, T.Dminimum);

Akzeptierte Antwort

VBBV
VBBV am 26 Dez. 2022
use [ ] operator as below or try with for loop which always works as intended
pred11= sprintf('\n Class 1 Butterfly Levels: %d\n\n\n Class 1 Butterfly DValue: [%s]\nMaximum Value of Butterfly:%d\nMinimum Value Butterfly :%d\n',...
[T.Levels; join(string(unique(T.DValue)),' '); T.Dmaximum; T.Dminimum]);
  22 Kommentare
Med Future
Med Future am 29 Dez. 2022
Bearbeitet: Adam Danz am 29 Dez. 2022
Okay Let me explain this to you I want to print value in appdesigner Table.
I have the Table in print.mat file in which different field exist. I have write the following code, which gives character array. which is basically in single line
pred11= sprintf('\n Class 1 Butterfly Levels: %d\n\n\n Class 1 Butterfly DValue: [%s]\nMaximum Value of Butterfly:%d\nMinimum Value Butterfly :%d\n',...
T.Levels, join(string(unique(T.DValue)),' '), T.Dmaximum, T.Dminimum);
I want to print in multiple line in appdesigner table for example like the following
Class 1 Butterfly Levels: 6
Class 1 Butterfly DValue: [80 85 355 550 600 650]
Maximum Value of Butterfly:650
Minimum Value Butterfly :80
VBBV
VBBV am 29 Dez. 2022
See snapshot below , if this is what you want
load('print.mat')
% this change below
vars = {'Class 1 Butterfly Levels','Class 1 Butterfly Dvalue','Maximum value of Butterfly','Minimum value of Butterfly'};
S = num2str(unique(T.DValue)) % convert the Dvalue to character
D = {vars{1},T.Levels;vars{2},S;vars{3},T.Dmaximum;vars{4},T.Dminimum};
fig = uifigure;
uit= uitable(fig);
uit.Data = D;
uit.Position = [71 61 500 233]; % modify the table size using its position property

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Develop uifigure-Based Apps finden Sie in Help Center und File Exchange

Produkte


Version

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by