Updating Table Data not working
이 질문을 팔로우합니다.
- 팔로우하는 게시물 피드에서 업데이트를 확인할 수 있습니다.
- 정보 수신 기본 설정에 따라 이메일을 받을 수 있습니다.
오류 발생
페이지가 변경되었기 때문에 동작을 완료할 수 없습니다. 업데이트된 상태를 보려면 페이지를 다시 불러오십시오.
이전 댓글 표시
0 개 추천
Hi Guys, This should be simple but I seem to be hitting a brick wall:
I use:
table = uitable('Data',data,'RowNames',rowNames,'ColumnNames',colNames);
I then try:
set(table,'Data',data2)
But I am getting the error "Invalid handle object"
Any thoughts?
Thanks in advance
Tim.
채택된 답변
Where is the second piece of code in relation to the first piece?
Strange, because it works just fine here:
RN = {'a','b','c'};
CN = {'col'};
dat = zeros(length(RN),length(CN));
table = uitable('Data',dat,'RowName',RN,'ColumnName',CN);
dat2 = ones(length(RN),length(CN));
set(table,'Data',dat2)
댓글 수: 10
Tim Mottram
2012년 9월 20일
편집: Tim Mottram
2012년 9월 20일
After it. Directly after it. I was just testing how I would do it before putting it in my code. data is:
zeros(length(rowNames),length(colNames));
and data2 is
ones(length(rowNames),length(colNames));
Matt Fig
2012년 9월 20일
It works for me. What version are you using?
Tim Mottram
2012년 9월 20일
Well, I just tested your code and it worked, then I tested mine again and I worked. So I don't know what happened but its working now. Many thanks.
Tim Mottram
2012년 9월 20일
I just checked again and the bit that isn't working is when I try to return the handle from a function. Is this possible?
I am using:
function table = makeTable(fileNames,data)
colNames = {'Spec Value','Spec Confidence','AVG Value','AVG confidence',...
'Var Value','Var Confidence','Pwr Value','Pwr Confidence',...
'Ibp Value', 'Ibp Confidence'};
table = uitable('Data',data,'ColumnName',colNames,'RowName',fileNames);
end
When I try to update using:
set(table,'Data',data2)
I get the "Invalid handle object." error
Yes, it should work. Did you have the function return the handle?
table = makeTable(....); % Return the handle
set(table,.....)
Tim Mottram
2012년 9월 20일
Yes, thats the only difference, executing from the command window works fine, from a function doesn't. I have MatLab 2010a. The function is the one I previously posted.
Wait a minute, what are you doing exactly? I assumed you have the function makeTable in a stand-alone M-file. From the command line you do this:
table = makeTable(ARGS); % Return handle. Use approp. args
set(table,ARGS)
but you are saying something else? If your setup is different, please specify exactly what you are doing. If it is as I describe, what does this return:
table = makeTable(ARGS); % Return handle. Use approp. args
[ishandle(table) table findall(0,'type','uitable')]
Image Analyst
2012년 9월 20일
Before you execute the set(table,...) command, set a breakpoint on that line. Then over the mouse over table. Does it give a valid handle number, like 185.2347, or does it say empty or null or something bad like that? Or just type table into the command window and tell us what it says there. It will give the value of table or else say that something's wrong. If it's not a floating point number like I said then you blew it away somehow, perhaps with a call to clear or delete.
Tim Mottram
2012년 9월 21일
Hi Guys, I'm really sorry, It was me being a total fool. I was closing the table before I updated the data. I'm really sorry if I have wasted your time. Thanks for all your help and patience.
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Logical에 대해 자세히 알아보기
태그
참고 항목
2012년 9월 20일
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!웹사이트 선택
번역된 콘텐츠를 보고 지역별 이벤트와 혜택을 살펴보려면 웹사이트를 선택하십시오. 현재 계신 지역에 따라 다음 웹사이트를 권장합니다:
또한 다음 목록에서 웹사이트를 선택하실 수도 있습니다.
사이트 성능 최적화 방법
최고의 사이트 성능을 위해 중국 사이트(중국어 또는 영어)를 선택하십시오. 현재 계신 지역에서는 다른 국가의 MathWorks 사이트 방문이 최적화되지 않았습니다.
미주
- América Latina (Español)
- Canada (English)
- United States (English)
유럽
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
