could "cellfun" solve my problem?

5 ビュー (過去 30 日間)
maha arcc
maha arcc 2015 年 9 月 3 日
コメント済み: maha arcc 2015 年 9 月 3 日
% Line Data for B-Bus (Shunt Admittance)Formation.
% function bbus = bbusppg,8 % Returns B-bus..
linedata = linedatas ,8;
fb = linedata(:,1);
tb = linedata(:,3);
b = linedata(:,7);
nbus = max(max(fb),max(tb)); % no. of buses...
nbranch = length(fb); % no. of branches...
bbus = zeros(nbus,nbus);
for k=1:nbranch
bbus(fb(k),tb(k)) = b(k);
bbus(tb(k),fb(k)) = bbus(fb(k),tb(k));
end
i got:
linedata =
[1] '1a' [3] '2a' [0.0024] [0.0183] [0.0264] [1]
[2] '1b' [7] '4a' [0.0540] [0.2230] [0.0246] [1]
[4] '2b' [5] '3a' [0.0470] [0.1980] [0.0219] [1]
[6] '3b' [1] '1a' [0.0346] [0.1055] [0.0215] [1]
[4] '2b' [8] '4b' [0.0024] [0.0173] [0.0345] [1]
Undefined function 'max' for input arguments of type 'cell'.
Error in bbusppg (line 9)
nbus = max(max(fb),max(tb)); % no. of buses...
if I apply "cellfun' is it work?could I apply this for columns 1,3&7 only .if yes,how? and if the answer No what can i do?!

回答 (1 件)

Kelly Kearney
Kelly Kearney 2015 年 9 月 3 日
You just need to convert your numeric data from cell arrays to a numeric arrays:
fb = cell2mat(linedata(:,1));
tb = cell2mat(linedata(:,3));
etc...
  2 件のコメント
maha arcc
maha arcc 2015 年 9 月 3 日
thanks,I'll try that
maha arcc
maha arcc 2015 年 9 月 3 日
can't thank you enough, I tried it and it worked :D

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

カテゴリ

Help Center および File ExchangeData Type Conversion についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by