clc
if vs=="AC"
c=0.8;
iv=acvi;
else
c=1;
iv=dcvi;
end
for k =1:numel(lo);
lva=lo(k)./c;
lvah=lva.*t;
ll=lo(k)./iv;
end
slo=sum(lo);
I have a sample script which i input to the above as a "function" ('AC',[25 45 65 78 120 65],8, 415,24) ie a string, vector and doubles now when i sum the input vector there is no drama for the initial vector however when i sum the other vectors, (lva,lvah,ll) i get the correct values after elementwise manipulation but cannot sum them i only the output of the last known value. Any ideas? I'm sure the solution is quite simple but its racking my brain. :(
Thanks,
Frank
2 Comments
Direct link to this comment
https://se.mathworks.com/matlabcentral/answers/593230-summing-elementwise-values-in-a-vector#comment_1007884
Direct link to this comment
https://se.mathworks.com/matlabcentral/answers/593230-summing-elementwise-values-in-a-vector#comment_1007884
Direct link to this comment
https://se.mathworks.com/matlabcentral/answers/593230-summing-elementwise-values-in-a-vector#comment_1007938
Direct link to this comment
https://se.mathworks.com/matlabcentral/answers/593230-summing-elementwise-values-in-a-vector#comment_1007938
Sign in to comment.