double() or int64() and then string() the result.
How do I convert a "py.int" into a string?
10 次查看(过去 30 天)
显示 更早的评论
Hello,
I have a python file that I am executing via pyrunfile that returns a number, the number is stored in Matlab as a py.int.
I need to turn this number into a string to append to an output, but neither str(py.int), string(py.int), num2str(py.int), or int2str(py.int) work.
Here is the approximate setup:
app.program_PID = pyrunfile("StartProgram.py", "PID");
class(app.program_PID) % py.int
disp(app.program_PID) % Python with int properties:
% denominator: [1x1 py.int]
% imag: [1x1 py.int]
% numerator: [1x1 py.int]
% real: [1x1 py.int]
% 99999
%Later
pyrunfile("StopProgram.py " + num2str( app.PhaseSpace_PID ) ); % This does not work "Input num2str must be numeric"
0 个评论
采纳的回答
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Call Python from MATLAB 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!