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

>> f = open('Al015Tantalum.fig'); >> a= get(gca, 'children')
a =
228.0011
174.0011
>> b= get(a, 'children')
b =
[0x1 double]
[0x1 double]
>> x=get(b','xdata') ??? Error using ==> get Conversion to double from cell is not possible.
>> y =get (b, 'YData') ??? Error using ==> get Conversion to double from cell is not possible.

回答 (2 件)

the cyclist
the cyclist 2013 年 2 月 23 日

0 投票

Well, b is empty (because the children of a don't have children, it seems).
So, you are trying to get properties from an empty set. Guessing that's why you got the error.
Youssef  Khmou
Youssef Khmou 2013 年 2 月 23 日
編集済み: Youssef Khmou 2013 年 2 月 23 日

0 投票

hi,
I think you get the error because you use "get" with cell .
IF your variables a and b contains data with same type you can use cell2mat :
example :
b=cell(4); % empty cell
x=get(cell2mat(b),'xdata');
y=get(cell2mat(x),'xdata');
% technically the code is correct but meaningless because it returns empty x
%and y .
ELSE , you can use cell as output:
x{1}=get(b{1},'XData');
y{1}=get({2},'YData');

5 件のコメント

ravit
ravit 2013 年 2 月 24 日
hi,
the problem is that i have the data on fig format on matlab, and i want to convert it to excel format. i changed some of the variables and than i get the next error.
>> f = open('Al015Tantalum.fig'); >> a= get(f, 'children')
a =
477.0011
431.0011
418.0011
>> b= get(a(2), 'children')
b =
435.0012
434.0012
433.0012
>> x = get(b,'XData') ??? Error using ==> get Invalid property found. Object Name : text Property Name : 'XData'.
the cyclist
the cyclist 2013 年 2 月 24 日
Try looking at each value of b individually. For example, try
>> x = get(b(1),'XData')
My guess is that not every handle in b has XData. You need to find the handle you need.
ravit
ravit 2013 年 2 月 24 日
hi, The only problem is that i have a lot of data on x and y values, something like 16,000 values, so how can i exam which has values on b and which not?
the cyclist
the cyclist 2013 年 2 月 24 日
You don't have to look at all values of x. You just have to look at each of the three values of b, to see which object has XData in it.
ravit
ravit 2013 年 2 月 24 日
thank you very much for your time and help. the problem with the figure file was that it contained data on the picture and i guess the matlab took it into account..

サインインしてコメントする。

カテゴリ

ヘルプ センター および File ExchangeCell Arrays についてさらに検索

質問済み:

2013 年 2 月 23 日

Community Treasure Hunt

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

Start Hunting!

Translated by