Unrecognized function or variable 'e'
显示 更早的评论
a = [1 2 3; 4 5 6; 7 8 9]
b = [7 5 6]
c = [19 23; 31 29; 17 13]
d = [e(1:2,:); f; e(3,:)]; % matrix f is inserted between the third and second row of e creating matrix d
e = [a(1,:);b(1,3);c(:,2).'] % matrix e consists of the first row of a, the second row of b and the transpose of the second column of c
f = c(:,1).' % matrix f is the transpose of the first column of matrix c
m = diag(a(:)) %
m = [diag(a); diag(b)] %
I was wondering why the matrix e wasn't recognised as it was working before.
When I tried it with 3 zeros [a(1,:); 0 0 0;c(:,2).'] . Why won't it accept b as the middle row?
1 个评论
Maybe this is some help? I don't know what you're doing with the second row of b, but f and e need to be defined before you can use them.
a = [1 2 3; 4 5 6; 7 8 9]
b = [7 5 6]
c = [19 23; 31 29; 17 13]
% "second row of b" ... but b only has one row?
% e = [a(1,:);b(2,:);c(:,2).'] % matrix e consists of the first row of a, the second row of b and the transpose of the second column of c
e = [a(1,:); b; c(:,2).'] % maybe you meant "the second row is b"?
f = c(:,1).' % matrix f is the transpose of the first column of matrix c
% f and e need to exist first
d = [e(1:2,:); f; e(3,:)] % matrix f is inserted between the third and second row of e creating matrix d
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Logical 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!