view usage of parameters in model.mld
조회 수: 5 (최근 30일)
이전 댓글 표시
Hy to all
I have a question please.
I use my_params.mat for my_params.mdl. How can I see what parameters from my_params.mat are not used in my_params.mdl. Because if there are no parameters used I need to delete them.
Any ideea? Is it ok to use textscan? I do not know exactly how but is this a start?
댓글 수: 0
답변 (3개)
Kaustubha Govind
2011년 9월 8일
You should be able to use:
>> [VarsOut]=Simulink.findVars('MyModel')
댓글 수: 3
Fangjun Jiang
2011년 9월 8일
+1, Kaustubha! I'd love to have those new OO methods. However, my main work is still in R2007b which does not have it. I think the OP doesn't either based on the error message. Since what version are these methods available?
Kaustubha Govind
2011년 9월 8일
Fangjun: Oops. The function was introduced in R2010a (see release notes: http://www.mathworks.com/help/toolbox/simulink/rn/bsawhtd.html#bsawljt).
Diana: Sorry, it looks like you may have an older version of MATLAB. :( Unfortunately, I think you might need to follow a manual process like Fangjun suggested. (Unless you can upgrade that is).
Fangjun Jiang
2011년 9월 8일
I am not aware of a direct or effective way doing it. How many parameters are there in the .mat file? If not many, you can clear one at a time and then do ctrl+D to update the model, if the parameter is used by the model, it will report an error since it's now cleared. Of course, this will not be practical if there are many parameters.
When setting parameters for a model file, .m file is usually used. Using .m file could also add unneeded parameters if proper "house-keeping" is not maintained. The problem for using .mat file to store parameters for a model file is, people usually use save() after model development or simulation to save the .mat file, it is more often that unneeded parameters in the workspace will be put in the .mat file.
댓글 수: 2
Fangjun Jiang
2011년 9월 8일
Are you trying to search the .mdl text file to find the reference of those parameter names? It's unlikely that you can achieve it. You can click menu Edit->Find to do that interactively, but only for known parameter name and one at a time. The real solution is the Simulink.findVars method suggested by Kaustubha. But unfortunately, it's only available at new versionS of MATLAB/Simulink.
Diana Acreala
2011년 9월 9일
댓글 수: 1
Fangjun Jiang
2011년 9월 15일
.mdl file is already an ASCII text file. If you really want to do it, you can do
!copy MyModel.mdl MyModel.txt
참고 항목
카테고리
Help Center 및 File Exchange에서 Programmatic Model Editing에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!