Cell contents reference from a non-cell array object.

조회 수: 3 (최근 30일)
Paul
Paul 2014년 12월 15일
댓글: Paul 2014년 12월 16일
Hi,
I am dealing with the following error:
Cell contents reference from a
non-cell array object.
The error points me to the following line:
Error using dataset/subsrefDot
(line 80)
which corresponds to:
update(conn, tablename, columnnames, data, whereclause);
Any ideas on how to deal with the error? If needed i can provide the full code as well.
  댓글 수: 6
Adam
Adam 2014년 12월 16일
Is
l_equities.CONVERSION
a cell array?
You can just stick a breakpoint in and easily find out this kind of thing from a fairly explicit error like that.
Paul
Paul 2014년 12월 16일
l_equities.CONVERSION
is a cell array yes.

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

채택된 답변

Sean de Wolski
Sean de Wolski 2014년 12월 16일
Apparently it's not a cell array at that point. Or something else is horribly wrong. This is where debug stop on errors is your best friend:
Run:
dbstop if error
This sets a condition to stop when an error is thrown so you can see everything as it is at the time of the error. Then recreate the error.
My magic eight ball guess is that l_equities.CONVERSION is empty; that it will eventually become a cell array but is not on your first iteration.
  댓글 수: 4
Sean de Wolski
Sean de Wolski 2014년 12월 16일
The above is not a cell array. If it was it would look like this:
ans =
[ 3]
[50]
[30]
[ 1]
And thus the {} braces are not appropriate. You could use (), it should no longer error for the same reason, but I don't know if the results are expected.
Paul
Paul 2014년 12월 16일
thanks

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

추가 답변 (2개)

Image Analyst
Image Analyst 2014년 12월 16일
It's not clear that l_equities.CONVERSION is even defined at that point. I searched the entire code you provided and the first time you even mentioned l_equities.CONVERSION was when you tried to display its values. But I would think you would have gotten a different error like "Reference to non-existent field 'CONVERSION'." so it probably got defined when you assigned EQUITIES_curs.Data to l_equities - "Data" must have been a structure itself with fields like "Conversion". What happens if you put these lines
l_equities
whos(l_equities)
fieldnames(l_equities)
whos(l_equities.CONVERSION)
after this call:
%Assign data to output variable
l_equities = EQUITIES_curs.Data
and also before the disp() call. Don't use semicolons at the ends of the lines.
And finally, I think "debugging by back and forth postings in a discussion forum" is tedious and takes way way too long, so what can you learn from this link.
  댓글 수: 1
Paul
Paul 2014년 12월 16일
thanks for all the answers. Indeed i replaced the brackets { by ( and the code works now

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


Paul
Paul 2014년 12월 16일
Problem solved by replacing these brackets { by (.

카테고리

Help CenterFile Exchange에서 Trading Technologies에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by