Thanks for taking the time to read this, I am new to matlab. This is the script I'm working on:
G=(m*n) where m=1:50 n=1:200 I want to make use of G in the following code to be executed. C = zeros(size(G)) ; [val,idx] = max(abs(G)) ; for i = 1:size(G,2) [val,idx] = max(abs(G(:,i))); C(idx,i) = (val); end
I would like this script to run for numerous values of G and return the answers, so I can plug them into a function and graph them. Right now I just want to know how to make the script run for multiple different values of G.

2 件のコメント

KSSV
KSSV 2017 年 11 月 28 日
Make it a function and run how many number of times you want.
Prabha Kumaresan
Prabha Kumaresan 2017 年 11 月 28 日
could you tell me to how to make a function

サインインしてコメントする。

 採用された回答

KSSV
KSSV 2017 年 11 月 28 日

2 投票

function C = myfunction(G)
C = zeros(size(G)) ;
% [val,idx] = max(abs(G)) ;
for i = 1:size(G,2)
[val,idx] = max(abs(G(:,i)));
C(idx,i) = (val);
end
Call the above function:
A = rand(5) ;
C = myfunction(A)
Note: YOu have asked many questions without accepting any answer.....give acknowledgements to people here by accepting and voting the answer.

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeArgument Definitions についてさらに検索

タグ

質問済み:

2017 年 11 月 28 日

回答済み:

2017 年 11 月 28 日

Community Treasure Hunt

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

Start Hunting!

Translated by