MATLAB Answers

Problem with Simulink Onramp Task 7.2

106 views (last 30 days)
Jonas Jarlmark Näfver
Jonas Jarlmark Näfver on 24 Jul 2019
Answered: Faiz Zaidi on 19 Sep 2020 at 1:01
During the Simulink Onramp, I've stranded on Task 7.2 with the following issue. All code is correct and checked a few times now. Since I don't know the function that errors or what input is of type char, I'm stuck. I've tested to replace the MATLAB function with the fcn-block and then everything works fine. As soon as I add a MATLAB function block, i get the error - no matter if it is the prepared block from the task or a nex from simulink. It does not matter what code I fill it with, so it feels like there is a missmatch in the communication from Simulink into the block type itself.
Problem on Task 7.2 MATLAB Function Block.JPG


Show 5 older comments

Sign in to comment.

Answers (3)

Srivardhan Gadila
Srivardhan Gadila on 5 Aug 2019
I have brought this issue to the notice of our developers. They will investigate the matter further.


Sign in to comment.

Jonas Jarlmark Näfver
Jonas Jarlmark Näfver on 1 Aug 2019
  • Starting Matlab R2018b
  • Starting Simulink from Matlab
  • Choosing Simulink Onramp
  • Choosing training 7.2 Matlab Function Block
  • Clicking Next twice on the instructions to get to the Simulink training editor for 7.2
  • Double clicking the predefined Matlab function block to get to the code editor for the block
  • It contains predefined code:
function power = fcn(deltaH)
Cp = 0.35; % Power coefficient
rho = 1000; % Density of water, kg/m^3
A = pi*10^2; % Area of turbine blade
g = 9.81; % Acceleration of gravity, m/s^2
% Replace the equation below with the correct equation for power
power = deltaH;
  • Modifying the last statement to
power = 0.5*Cp*rho*A*(2*g*abs(deltaH))^(3/2);
  • Saving the file
  • Connection the Matlab function block to the Siglnal Assesment
  • Clicking Submit
Doing this opens the Diagnostics viewer with the following message:
Undefined function 'fixed.internal.clearLog' for input arguments of type 'char'.
After that I tried to work around the problem and see what could be the issue.
Simple code in the predefined function - same error
A new matlab function block with the same code as the predefined (written, not copied) - same error
A regular function block doing a square of the signal - works, no error - but does not solve the task.
My conclusion is that there is someting going on with the Matlab function block in this task. If it is due to me using R2018b or someting within the training setup, I have no clue. All other training steps in the Simulink Onramp worked like a charm. Also the Matlab Onramp and Deep Learning Onramp are fine.

  1 Comment

Jonas Jarlmark Näfver
Jonas Jarlmark Näfver on 1 Aug 2019
I also had this warning on starting Simulink from Matlab:
Warning: an error occurred while parsing class mpt.MiscCustomizer:
Undefined function or variable 'ecoderinstalled'.
> In slCustomizer/internalCustomizationSimulink
In slCustomizer/callAllMethods
In slCustomizer/refresh
In slCustomizer.staticRefresh
In sl_refresh_customizations (line 22)
In slcustomize (line 4)
In simulinkrc (line 34)
In start_simulink (line 19)
In connector.internal.fevalMatlab
In connector.internal.fevalJSON

Sign in to comment.

Faiz Zaidi
Faiz Zaidi on 19 Sep 2020 at 1:01
The problem was with incorrect or not enough placements of brackets .
use this code
power = 0.5*Cp*rho*A*(2*g*abs(deltaH))^(3/2);
it will surely work


Sign in to comment.

Community Treasure Hunt

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

Start Hunting!

Translated by