필터 지우기
필터 지우기

define the local variable in Function to global

조회 수: 2 (최근 30일)
bahar vojdani
bahar vojdani 2022년 2월 19일
댓글: bahar vojdani 2022년 2월 20일
function data= ReadGrasshopperFile( ~, ~,~)
x = randi(10, 1);
y = randi(10, 1);
z = randi(10, 1);
parameters = [x, y, z];
fileName1='M2GHfileName.csv';
fileName2='GH2Matlab.csv';
writematrix(parameters, fileName1);
data = readmatrix(fileName2);
end
This function that I defined it works good.
But, I wanted the x and y and z changed each time that I recall function.
what should I do?
  댓글 수: 10
Torsten
Torsten 2022년 2월 20일
I don't understand what you are trying to do, but I repeat:
The optimization toolbox cannot cope with random inputs that change with iteration.
So you can create random input, but it must remain constant during the optimization process.
bahar vojdani
bahar vojdani 2022년 2월 20일
I wanted to creat a function that gives ne random number and save these variable in csv file, after a sleep time read other csv file. I dont want to use optimization toolbox; I use a swarm optimization.

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Logical에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by