Skip to content
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

Open
wants to merge 4 commits into
base: develop
Choose a base branch
from

Conversation

simmsa
Copy link
Contributor

@simmsa simmsa commented Jan 21, 2025

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 and html files.

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.
@simmsa simmsa requested a review from MShabara January 21, 2025 20:58
@simmsa simmsa marked this pull request as ready for review January 21, 2025 20:59
@simmsa simmsa requested a review from akeeste January 21, 2025 21:00
@simmsa
Copy link
Contributor Author

simmsa commented Jan 21, 2025

@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

Copy link

@akeeste akeeste left a 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants