different view in uitable app designer

to sx the variable in workspace... (T= struct2table(Sis);)
to dx the variable in appdesigner as table ( app.UITable_mincap_2.Data=Table_DataAllSystem_Struct(app.Sis);)
in both =1 but only one line is written differently

댓글 수: 12

Taylor
Taylor 2023년 11월 3일
Try using the class or eps functions to identify if the data point has the same precision.
piero
piero 2023년 11월 3일
편집: piero 2023년 11월 3일
okk but class what is?
can you give me an example to use it? thank
Walter Roberson
Walter Roberson 2023년 11월 3일
I suspect that the value there is just slightly different than 1. You can pull the value out of the uitable and subtract 1 and see the difference
piero
piero 2023년 11월 4일
the difference is zero...infact in the workspace the value is correct
I notice that your gg-1 results in a row vector. If you had extracted the data from the stored uitable then I would have expected a column vector.
For testing,
temp = app.UITable_mincap_2.Data;
mask = temp.NameOfVariableWithCurrencyInIt == 'USD';
subset = temp(mask,:);
usdvalue = subset.NameOfVariableWithNumericvalueInIt;
format long g
usdvalue - 1
piero
piero 2023년 11월 4일
Error using .
Unrecognized table variable name 'NameOfVariableWithCurrencyInIt'.
Error in Predator_Equity/SystemDateTabButtonDown (line 378)
mask = temp.NameOfVariableWithCurrencyInIt == 'USD';
The information you have given us is that you have a table. You have not shown us the names of the variables in the table, and we have to assume that there might be more columns in the table than you showed us, so we do not know the column numbers involved.
So I put in names that are instructions about how you should change the code.
mask = temp.NameOfVariableWithCurrencyInIt == 'USD';
replace "NameOfVariableWithCurrencyInIt" with the name of the variable which holds the currency name information
usdvalue = subset.NameOfVariableWithNumericvalueInIt;
replace "NameOfVariableWithNumericvalueInIt" with the name of the variable that holds the number that you are showing us
For example maybe the code should look like
temp = app.UITable_mincap_2.Data;
mask = temp.Currency == 'USD';
subset = temp(mask,:);
usdvalue = subset.ExchangeRate;
format long g
usdvalue - 1
if the names of the two variables involved are Currency and ExchangeRate.
If the table happens to hold only the two columns you showed us then you can use
temp = app.UITable_mincap_2.Data;
mask = temp.(1) == 'USD';
subset = temp(mask,:);
usdvalue = subset.(2);
format long g
usdvalue - 1
piero
piero 2023년 11월 4일
temp = app.UITable_mincap_2.Data;
mask=string(temp.Currency)=='USD'; %temp.Currency ==>it's a cell..i use string(...)
mask =
73×1 logical array
1
1
1
1
1
1
0
0
0
0
subset = temp(mask,:); %%i get error using that...
Unrecognized function or variable 'subnet'.
Walter Roberson
Walter Roberson 2023년 11월 5일
You mistyped. I used the variable named subset but the error message shows you accidently used the name subnet
piero
piero 2023년 11월 5일
편집: piero 2023년 11월 5일
correct..
Now written correctly and the result is all equal to zero
if the data is not confidential then please store
Table_DataAllSystem_Struct(app.Sis)
into a variable, and save to a mat file and attach the mat file
piero
piero 2023년 11월 5일
this is file..

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

답변 (1개)

Walter Roberson
Walter Roberson 2023년 11월 5일

0 개 추천

Experimentally:
It appears that the formatting of rows in the table works on some kind of buffer system having to do with which values are currently visible (the row is scrolled into range, even if the column itself is not.)
The rule appear to be that if anywhere in the current "buffer"-full the row contains a non-integer value, that the entire buffer-full for that column may be formatted as floating point. But only if the values have absolute value less than 1000: from 1000 upwards, the individual non-integer item will be formatted in scientific notation but the integer items in the buffer-full will be formatted as integers.
This is definitely not a behaviour I would have expected.

댓글 수: 4

piero
piero 2023년 11월 5일
ok I'll leave it alone then
piero
piero 2023년 11월 5일
would the only solution be to transform it into a string using the compose function?
Walter Roberson
Walter Roberson 2023년 11월 5일
You could consider using convertvars . However probably varfun with compose would be a better bet: if you just string() a column then it uses odd internal rules for the conversion, whereas if you invoke compose with an anonymous function you could specify the conversion format.
piero
piero 2023년 11월 6일
okkk

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

카테고리

도움말 센터File Exchange에서 Develop Apps Using App Designer에 대해 자세히 알아보기

질문:

2023년 11월 3일

댓글:

2023년 11월 6일

Community Treasure Hunt

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

Start Hunting!

Translated by