MDL Files as Text - Change maximum line length?

2 visualizaciones (últimos 30 días)
Conor Sullivan
Conor Sullivan el 18 de Mzo. de 2021
Respondida: Arun el 21 de Feb. de 2024
I'm using UNIX grep to quickly find specific strings in MDL files. I'm running into trouble when the string of interest is broken up by a newline or line feed character.
When opening a MDL file as text, the maximum length of any line appears to be 123 characters. Is there any way to increase this limit?
I can manually change the line in a text editor, and Matlab seems to open the editied MDL just fine, but when I resave, the line is reverted to 123 characters and line feed.
For example, I'm looking for "function_i_want_to_find", but in the MDL file we get
labelString "[output_flag, output_AAAA, output_BBBB, outtput_CCCC, output_DDDDD, output_EEEE] = function_i_wa"LF
"nt_to_find(input_a,input_b,input_c, input_d)"LF

Respuestas (1)

Arun
Arun el 21 de Feb. de 2024
Hi Conor,
I understand that when you open a MDL file it is wrapped for maximum line length to be 123 characters because of which you are not able to use UNIX grep to find specific strings in MDL files.
Try disabling the “word wrap” view setting or something similar (this setting may vary) based on the editor, which might cause the line change. Disabling the editor settings will help. For mdl files, line length is not limited to 123 characters.
However, while using the UNIX grep, you can use the following command to include line change while matching the string:
$ grep -zoP ‘function_i_want_to_find | use_different_regular_expression_you_want_to_try_with_line_chage” your_model.mdl
This will help match the required string even after the line changes. Here is a screenshot for reference.
You can also use the command “pcregrep -M 'function_i_wa(.|\n)*nt_to_find' your_model.mdl” for similar purpose.
For more information regarding Simulink preference please reference the shared documentation link: https://www.mathworks.com/help/simulink/slref/simulinkpreferences.html
Hope this helps.

Categorías

Más información sobre Programmatic Model Editing en Help Center y File Exchange.

Etiquetas

Productos

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by