could "cellfun" solve my problem?
1 view (last 30 days)
Show older comments
% 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 Comments
Answers (1)
Kelly Kearney
on 3 Sep 2015
You just need to convert your numeric data from cell arrays to a numeric arrays:
fb = cell2mat(linedata(:,1));
tb = cell2mat(linedata(:,3));
etc...
See Also
Categories
Find more on Cell Arrays in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!