define a function like python
18 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Hello all,
I have a fuction in python but I want to write like this in Matlab.
def link_to_grasshopper(x):
# x is a numpy array
# part 1: from jupyter to GH
df = pd.DataFrame(remap(x))
df.to_csv('X.csv')
# wait pls
sleep(120.0)
# part 2: from GH back to jupyter
f = pd.read_csv('Fitness.csv')
return f.values[0][0]
5 Kommentare
Image Analyst
am 18 Feb. 2022
So did you take what I gave below and try to continue with it? If not, why not? Let's see your latest version of it.
Antworten (1)
Image Analyst
am 17 Feb. 2022
Perhaps something like this:
function data = ReadGrasshopperFile(x, fileName1, fileName2)
% x is a numpy array
% part 1: from jupyter to GH
df = pd.DataFrame(remap(x))
% Write to CSV file
writematrix(df, fileName1);
% wait pls
sleep(120.0)
% part 2: from GH back to jupyter
data = readmatrix(fileName);
end
Or maybe at least it's a start, since I'm not really sure what all those things in your Python code are.
3 Kommentare
Walter Roberson
am 5 Mai 2022
https://www.mathworks.com/matlabcentral/answers/9957-using-net-filesystemwatcher-to-listen-for-new-files#answer_13710
Siehe auch
Kategorien
Mehr zu Integration with Online Platforms finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!