could "cellfun" solve my problem?
1 回表示 (過去 30 日間)
古いコメントを表示
% 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?!
0 件のコメント
回答 (1 件)
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...
参考
カテゴリ
Help Center および File Exchange で Cell Arrays についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!