undefined function or variable 'z' erro message
1 次查看(过去 30 天)
显示 更早的评论
<</m
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/147633/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/147635/image.png)
when I added a powergui block, this error messages keep appearing, i have used 'ctrl f' to find the variable 'z', but i did not find it. Thank you!
0 个评论
回答(1 个)
Christiaan
2015-3-10
Dear Runsheng,
If Simulink looks for the variable z and cannot find it, you could initialize this variable either from a constant block, the workspace, an m-file or direct in the initialization step of the model.
If you like to initialize z from the workspace, use the 'from workspace' block. Set the block parameter variable to z, and use i.e. the matlab prompt to define z.
If you like to initialize z at the start of the program, go to file->model properties->model properties->callbacks->InitFcn. Here you can type in z=1 (in Example)
If you like to initialize z at the start of the program, go to file->model properties->model properties->callbacks->InitFcn. Here you can type in initialise. If you now make an m-file which is called initialise.m where the value z is stored, you can initialise the simulink program over a mfile.
Good Luck, Christiaan
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Simscape Electrical 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!