フィルターのクリア

Error:Conversion to cell from logical is not possible.

3 ビュー (過去 30 日間)
kash
kash 2012 年 7 月 24 日
I my program i have a done aa
r=[Dataset(:,1) Sf]
where the output or r is
r =
'yaddata' 'c1' 'c2' 'c3' 'c4' 'c5'
'yar12' 'hi' 'hello' 'hi' 'hello' 'hi'
'yar13' 'hello' 'hi' 'hi' 'hello' 'hi'
'yar14' 'hi' 'hi' 'hi' 'hello' 'hello'
'yar15' 'hello' 'hi' 'hi' 'hi' 'hi'
'yar16' 'hello' 'hi' 'hi' 'hello' 'hello'
'yar17' 'hi' 'hi' 'hi' 'hi' 'hi'
for count=2:size(r,1)
out(count,:)=strcmp(r(count,:),r(count,2));
check_sum(count)=sum(out(count,:));
end
output=r(check_sum>2,:);
p=out(check_sum>2,:)
p(:,1)=1;
[r,c]=find(p==1);
for ii=1:length(r)
a=r(ii);
b=c(ii);
final(a,b)=output(a,b);
end
final
I get error as
Conversion to cell from logical is not possible.
Error in ==> samplenew at 204
out(count,:)=strcmp(r(count,:),r(count,2));
please help

採用された回答

Andrei Bobrov
Andrei Bobrov 2012 年 7 月 24 日
r = {
'yaddata' 'c1' 'c2' 'c3' 'c4' 'c5'
'yar12' 'hi' 'hello' 'hi' 'hello' 'hi'
'yar13' 'hello' 'hi' 'hi' 'hello' 'hi'
'yar14' 'hi' 'hi' 'hi' 'hello' 'hello'
'yar15' 'hello' 'hi' 'hi' 'hi' 'hi'
'yar16' 'hello' 'hi' 'hi' 'hello' 'hello'
'yar17' 'hi' 'hi' 'hi' 'hi' 'hi'};
[a,b,b] = unique(r(2:end,2:end));
n = reshape(b,size(r(2:end,2:end)));
id = bsxfun(@eq,n,n(:,1));
out = r(2:end,1:end);
out([false(size(out,1),1) ~id]) = {[]};
out = out(sum(id,2) > 2,:);

その他の回答 (1 件)

venkat vasu
venkat vasu 2012 年 7 月 24 日
編集済み: Andrei Bobrov 2012 年 7 月 24 日
r = {
'yaddata' 'c1' 'c2' 'c3' 'c4' 'c5'
'yar12' 'hi' 'hello' 'hi' 'hello' 'hi'
'yar13' 'hello' 'hi' 'hi' 'hello' 'hi'
'yar14' 'hi' 'hi' 'hi' 'hello' 'hello'
'yar15' 'hello' 'hi' 'hi' 'hi' 'hi'
'yar16' 'hello' 'hi' 'hi' 'hello' 'hello'
'yar17' 'hi' 'hi' 'hi' 'hi' 'hi'};
for count=2:size(r,1)
out(count,:)=strcmp(r(count,:),r(count,2));
check_sum(count)=sum(out(count,:));
end
output=r(check_sum>2,:);
p=out(check_sum>2,:)
p(:,1)=1;
[r,c]=find(p==1);
for ii=1:length(r)
a=r(ii);
b=c(ii);
final(a,b)=output(a,b);
end
final
I have checked the coding i did'nt get any error i got the output is following
p =
0 1 0 1 0 1
0 1 1 1 0 0
0 1 0 0 1 1
0 1 1 1 1 1
final =
'yar12' 'hi' [] 'hi' [] 'hi'
'yar14' 'hi' 'hi' 'hi' [] []
'yar16' 'hello' [] [] 'hello' 'hello'
'yar17' 'hi' 'hi' 'hi' 'hi' 'hi'
  2 件のコメント
kash
kash 2012 年 7 月 24 日
If u paste the code ,u get answer but if am running the whole program ,nearly 100 lines (r=[Dataset(:,1) Sf] is 101th line)i get the error
Jan
Jan 2012 年 7 月 24 日
Then, kash, some other code cause the error. It is your turn to find the reasons, because we do not have your 100 lines program.

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

カテゴリ

Help Center および File ExchangeArgument Definitions についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by