Assignment has more non-singleton rhs dimensions than non-singleton subscripts

2 ビュー (過去 30 日間)
nt
nt 2012 年 12 月 13 日
回答済み: Tree 2014 年 1 月 19 日
I am trying to figure out to format the numbers in the uitable to have thousands seperator. I am adding this undocumentd java code lines to achive it but gives me the below error. I can tell if i m using the undocumented code wrong or not? I appreciate any help on this.
c = tp(:,1);
c(1,:)=[];
g = spend_and_elas(:,1);
inf=java.text.DecimalFormat;
ho=char(inf.format(hist_out));
hr=char(inf.format(hist_rev));
k=grps(:,1);
k(1,:)=[];
k(:,2)=num2cell(ho);
% k(:,2)= mat2cell(ho);
k(:,3)=num2cell(hr);
set(handles.tpoints,'data',[ c num2cell(g)]);
set(handles.model,'data',k);
Assignment has more non-singleton rhs dimensions than non-singleton subscripts
Error in Top_Down_Optimizer_vn>pushbutton_Load_Data_vn_Callback (line 122)
k(:,2)=num2cell(ho);
  2 件のコメント
Matt Fig
Matt Fig 2012 年 12 月 13 日
編集済み: Matt Fig 2012 年 12 月 13 日
What is ho?
whos ho
And what is grps?
whos grps
nt
nt 2012 年 12 月 13 日
i m tring to format " hist_out " and create it ho which will be formatted version of hist_out
grps is a matrix

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

採用された回答

Matt J
Matt J 2012 年 12 月 14 日
If num2cell(ho) has more than 2 dimensions (you can check ndims(num2cell(ho))), then
k(:,2)=num2cell(ho);
makes no sense. The left hand side is being treated as 2-dimensional
  2 件のコメント
nt
nt 2012 年 12 月 17 日
thanks, also have this error when i use java to format thousand seperator for hist_rev. It works if when hist_rev is 1,1 but not when it s one dim vector. I can not come up with a solution to this. I appriciate if you suggest one. Regards,Nazmi
>> ho= char(inf.format(hist_rev)) Java exception occurred: java.lang.IllegalArgumentException: Cannot format given Object as a Number
at java.text.DecimalFormat.format(Unknown Source)
at java.text.Format.format(Unknown Source)
Matt J
Matt J 2012 年 12 月 17 日
編集済み: Matt J 2012 年 12 月 17 日
Post it as a new question where Java SMEs can see it.

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

その他の回答 (1 件)

Tree
Tree 2014 年 1 月 19 日
Has this been identified as a bug? If so can it be fixed?
I've run across the same error while trying to convert cells to chars via a for loop.

カテゴリ

Help Center および File ExchangeApp Building についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by