I learned a little Matlab and Python Joint programming of , Need to be in Matlab Use in Python list Variable , The reference routine given says that you want to return the data Python list convert to Matlab Of double array
tempForecast = double(forecast.temp)
among forecast.temp It's the temperature forecast , It's a Python Of list type , Use double The function wants to convert , However, the following error messages will appear :
terms of settlement :
According to the official documents , Consider using it first cell Into a cellular array , And then use cellfun Conduct array( matrix ) Transformation of form . The specific code is as follows :
temp=cell(forecast.temp);
tempForecast = cellfun(@double,temp)
So there's no mistake .
Allied , If it is string Type to be converted :
current_time=cell(forecast.current_time)
T=cellfun(@string, current_time)
cellfun Change the first parameter of the function to the type to be converted string That's all right. .
Make a note of , It may be useful in the future .
Reference material
[1] stay MATLAB Use in Python list Variable