define the local variable in Function to global

3 visualizaciones (últimos 30 días)
bahar vojdani
bahar vojdani el 19 de Feb. de 2022
Comentada: bahar vojdani el 20 de Feb. de 2022
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 comentarios
Torsten
Torsten el 20 de Feb. de 2022
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 el 20 de Feb. de 2022
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.

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Más información sobre Surrogate Optimization en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by