-
Notifications
You must be signed in to change notification settings - Fork 178
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Function to format variable as string #435
Comments
Hello, if my num2str can be combined with your code, especially the forlab_num2str.fypp :
----------------------
num2str(c):
(1.00000000,1.00000000)
(1.00,1.00)
num2str(i):
2
2
num2str(r):
1.00000000
1.00
forlab_disp.fypp :
----------------------
disp(ones(c)):
(1.000,1.000) (1.000,1.000)
(1.000,1.000) (1.000,1.000)
disp(ones(i)):
1 1
1 1
disp(ones(r)):
1.000 1.000
1.000 1.000
disp(l)
T T T
T T T
----------------------
disp(ones(c)):
(0.1000E-03,0.000) (1.000,1.000)
(1.000,1.000) (1.000,1.000)
disp(ones(i)):
1 1
1 1
disp(ones(r)):
0.1000E-03 0.000
1.000 1.000 |
This is great @zoziha, I think the display function would make a great addition to stdlib. |
dispWow, thank you for your approval, I think I will consider perfecting num2str?I think we have implemented the function: num2str(x [, fmt])
subroutine: disp(x [, string]) Hope to receive your reply. |
I think the implementation is uncritical, If you are interested, feel free to use the |
Hello, I submitted a PR, which contains |
We can already format integer and logical variables to strings, but we don't have routines to write floating point values yet. Maybe we can implement a simple solution by wrapping the internal IO in a function as a separate module. The size of the buffer might be problematic since it can overflow in case a format specifier like
'(10000x, g0)'
is passed.The actual implementation is pretty straight-forward:
The text was updated successfully, but these errors were encountered: