-
Notifications
You must be signed in to change notification settings - Fork 24
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
Add Strain Example from MHKiT-Python #156
Conversation
Uses MATLAB's Markup syntax (similar to Markdown) to create a Livescript example in .m format. This format allows version control diffability while maintaining Livescript functionality when opened in MATLAB. The Markup specification is documented here: https://www.mathworks.com/help/matlab/matlab_prog/marking-up-matlab-comments-for-publishing.html. This approach is forward-compatible with MATLAB R2024b's new plain text format for Live Scripts: https://www.mathworks.com/help/matlab/matlab_env/beta-new-desktop-for-matlab.html To hedge against MATLAB removing support for Markup it is also recommended to generate the `.mlx` and `html` files.
@MShabara and @akeeste this is ready for review. Right now this just mimics the functionality from the MHKiT-Python Strain Example: https://github.com/MHKiT-Software/MHKiT-Python/blob/main/examples/strain_measurement_example.ipynb |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@simmsa a couple minor fixes:
- The images "resulting_loads_resized.png" and "global_cs_resized.png" have their names swapped. Once the names are switched, the images will match the filenames and they will be referenced correctly in the .mlx and .m files
- some subtitles from the python notebook are included in the
mlx
but don't format quite right- "90 degree rosettes"
- "Alternate equations for 120 degree rosettes"
- "Define equations for normal force, moment, and torsion"
Otherwise all the calculations and plots look good and match the python example.
On file formats--A diffable livescript would be great, but it seems like MATLAB is a few releases away before that's widely supported in the MATLAB GUI itself. Though publishing the .m file straight to html is easy and can give the same advantage. I don't ever use the publish functionality, but it was pretty easy to click through and get a nicely formatted HTML file. Could the publishable .m file replace the mlx files entirely? A user could quickly publish the .m file (or view the documentation) to see plots and comments in line, while also having the code readily accessible in a familiar format.
@akeeste, thanks for taking a look at this. I fixed the images and formatting and I think this is good to go.
A publishable .m file would me a great end goal for all examples in this project, but yes we need to be cautious about past versions of MATLAB. On my current version of MATLAB (2024a) I am able to perform these conversions, but it would wise to verify this functionality across multiple versions. For now I think a reasonable strategy is to build new notebooks using Markup, but always render to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@simmsa that sounds like a good plan. With those latest changes, this looks good to merge
@simmsa I agree with @akeeste that the PR is ready to be merged. @akeeste I have a couple of theory questions related to the |
@MShabara Maybe we could make this more clear by breaking out the calculations into, e.g.:
similarly for the bending moment calculation. |
Use MATLAB's Markup syntax (similar to Markdown) to create a Livescript example
in .m format. This format allows version control diffability while maintaining
Livescript functionality when opened in MATLAB.
The Markup specification is documented here:
https://www.mathworks.com/help/matlab/matlab_prog/marking-up-matlab-comments-for-publishing.html.
This approach is forward-compatible with MATLAB R2024b's new plain text
format for Live Scripts:
https://www.mathworks.com/help/matlab/matlab_env/beta-new-desktop-for-matlab.html
To hedge against MATLAB removing support for Markup it is also
recommended to generate the
.mlx
andhtml
files.