Their is error (Undefined function or variable 'new'.) plz help to solve.

function new = fact(i)
for o=1:size(i, 1)
for j=1:size(i,2)
new (o,j,1)=i(o,j,1)*2;
new (o,j,2)=i(o,j,2)*2;
new (o,j,3)=i(o,j,3)*1;
end
end

 채택된 답변

Walter Roberson
Walter Roberson 2018년 10월 1일
편집: Walter Roberson 2018년 10월 1일

1 개 추천

Spacing is important in this case, because of command/function duality

function new = fact(i)
    for o=1:size(i, 1)
    for j=1:size(i,2)
    new(o,j,1)=i(o,j,1)*2;
    new(o,j,2)=i(o,j,2)*2;
    new(o,j,3)=i(o,j,3)*1;
    end
    end

추가 답변 (0개)

질문:

2018년 9월 30일

편집:

2018년 10월 1일

Community Treasure Hunt

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

Start Hunting!

Translated by