Error using ==> get. Conversion to double from cell is not possible.

조회 수: 3 (최근 30일)
Louise
Louise 2011년 2월 27일
Hello all, I am trying to access data I saved from a uitable in another function. I have a savebutton and here is what I put under the callback function:
% Saves the current values for all accounts handles.oldAsset = get(handles.tableAsset,'Data');
In another function, I have:
oldAssets = get(handles.oldAsset, 'Data');
but it gives the error, 'Error using ==> get. Conversion to double from cell is not possible.'
I need to be able to compare data from handles.oldAsset to the updated version using strings, but
oldAssets = str2num(handles.oldAsset);
gives me NaN values for string data.
How am I able to access handles.oldAsset without losing the strings in the cells?
Thanks a lot!

답변 (1개)

Walter Roberson
Walter Roberson 2011년 2월 27일
When you execute
handles.oldAsset = get(handles.tableAsset,'Data');
then handles.oldAsset will be set to the Data contents of the uitable, in cell array format. But then you try to get() the 'Data' property of that cell array itself, and of course that fails because the cell array is not a handle.
Why do you need to compare the data using strings? Why not compare the binary data? isequal() can be used on strings and on numeric data.

카테고리

Help CenterFile Exchange에서 Develop Apps Using App Designer에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by