フィルターのクリア

Info

この質問は閉じられています。 編集または回答するには再度開いてください。

variable number of inputs of function

1 回表示 (過去 30 日間)
vijay
vijay 2013 年 2 月 20 日
閉鎖済み: MATLAB Answer Bot 2021 年 8 月 20 日
function []=mainprog()
clc
len=5
for i=1:len
eval(['scalar', num2str(i), '= randi(10,1,3)']);
end
rqarray=[10,20,30,40,50]
weighted=weightedimage(scalar,rqarray)
function weighted=weightedimage(scalar,rqarray);
for i=1:len
w=rqarray(1,i)
J=w * [scalar]
allzero=zeros(1,3)
wfinal=allzero+w
Jfinal=allzero+J
end
weighted=Jfinal./wfinal
In this program in the function weightedimage, how we should write input named as scalar in the bold lines. if i write it as scalar it gives error. The scalar is hving different values as scalar1, scalr2,scalar3.......... Please tell me how can i do this.

回答 (1 件)

Walter Roberson
Walter Roberson 2013 年 2 月 20 日

この質問は閉じられています。

Community Treasure Hunt

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

Start Hunting!

Translated by