mathworks / mathworks/MATLAB-Coding-Guidelines
Naming rules for struct/class/bus
Nobody has claimed this yet.
- Dominant language
- No language data
- Stars
- 139
- Forks
- 11
- PR merge metrics
- No merged PRs in 30d
Description
I noticed there isn’t yet an explicit guideline for struct names and, in particular, for struct field names. The only related reference I found, “Defining structs”, includes an example where the struct members use UpperCamelCase. Should these be UpperCamelCase? And if so, should the same convention apply to Simulink.Bus elements?
I’m asking because this can create a mismatch with some Model Advisor naming guidelines. For example, suppose I have a Simulink Inport of type Bus, with elements Signal1 and Signal2, which has been created from a MATLAB struct or class. If I use a Bus Selector to extract Signal1 and feed it into a MATLAB Function block, where the corresponding function parameter is named signal1 (lowerCamelCase, following MATLAB function parameter conventions), Model Advisor will trigger a violation because the bus element name (UpperCamelCase) doesn’t match the block input name (lowerCamelCase).
Is there any recommendations on how to harmonize these conventions?
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading the existing “Defining structs” guidance and the Model Advisor naming guidelines referenced in the issue. Compare conventions for MATLAB struct and class fields with Simulink.Bus elements and document a consistent recommendation that resolves the described bus-to-MATLAB Function naming mismatch.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- matlab
- Domain
- documentation
- Issue type
- Documentation
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100