hi everyone, i am using a gui application and i faced this error about putting data in uitable:
da(1,2)=num2cell(horzcat(num2str(a),'±',num2str(b)));
set(handles.uitable1, 'data', da);
Assignment has more non-singleton rhs dimensions than non-singleton subscripts
can you please help me with that.
thank you

 채택된 답변

Guillaume
Guillaume 2017년 6월 15일
편집: Guillaume 2017년 6월 15일

0 개 추천

It's most likely that the error comes from the 1st line. What are you trying to do with that line:
da(1,2) = num2cell(horzcat(num2str(a),'±',num2str(b)));
Unless da is some custom object that overrides standard () assignment the above would result in an error.
I strongly suspect that the num2cell call is a mistake.

댓글 수: 3

best16 programmer
best16 programmer 2017년 6월 15일
편집: best16 programmer 2017년 6월 15일
thank you for the answer,i tried to remove the num2cell and it gives me the following error:
Conversion to cell from char is not possible.
Guillaume
Guillaume 2017년 6월 15일
편집: Guillaume 2017년 6월 15일
Possibly, this is what you want. It's a complete guess since you haven't said what it is you're trying to do:
da{1, 2} = [num2str(a), '±', num2str(b)];
or in my opinion, clearer with sprintf:
da{1, 2} = sprintf('%g±%g', a, b);
and learn how to index cell arrays
best16 programmer
best16 programmer 2017년 6월 15일
thank you.it works great

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

추가 답변 (1개)

Devony Whiting
Devony Whiting 2020년 1월 27일

0 개 추천

I have a table that has no errors running, but will not display the entire table. I have played around with the dimensions in the code and that does not seem to change the size of the window the tble is in, which is much too small. Is there a way to change this?
Thank you!

카테고리

도움말 센터File Exchange에서 Develop Apps Using App Designer에 대해 자세히 알아보기

제품

질문:

2017년 6월 15일

답변:

2020년 1월 27일

Community Treasure Hunt

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

Start Hunting!

Translated by