MATLAB Answers

app.UITable.Data assignment problem

6 views (last 30 days)
hello,
I am having problem in assigning to app.UITable.Data.
My code is below
[Whole_data,txt,raw]=xlsread('shim_result.xlsx');
app.UITable.Data(row_nummber,2)=raw(row_nummber,2);
here, raw(row_nummber,2) is date time.
it shows the error message"Conversion to double from cell is not possible."
If I convert the date time to double than it does not appears in the table in the normal year- month-day format.
I cant change the whole table to date time as there are other numeric values. The table that I am developing in app designer has the following columns
Pallet number | date time | adjustmnet| shim dimension
Please help me.
Kind regards
Sharmin

  3 Comments

Geoff Hayes
Geoff Hayes on 6 May 2020
Sharmin - what happens if you use braces instead of brackets in the assignment?
app.UITable.Data{row_nummber,2}=raw(row_nummber,2);
Guillaume
Guillaume on 6 May 2020
@Geoff, the problem is the other way. It's raw(row_nummber,2) that is the cell array and Data the double array.
Sharmin Sultana Sheuly
Sharmin Sultana Sheuly on 6 May 2020
Hello,
Thanks for your help. I have solved the problem.
regards
Sharmin

Sign in to comment.

Accepted Answer

Guillaume
Guillaume on 6 May 2020
Edited: Guillaume on 6 May 2020
raw(row_nummber,2) is a cell array (made of just one cell),
raw{row_number, 2} is the content of that cell. As long as that content is a scalar double, then:
app.UITable.Data(row_nummber,2)=raw{row_nummber,2}; %note the use of {} to get the content of the cell
should work (assuming Data is a double matrix).
edit: see Access data in a cell array to understand the difference between {} and () when indexing cell arrays.

  0 Comments

Sign in to comment.

More Answers (0)


Translated by