.. highlightlang:: us .. index:: ch .. _ch: ch == .. us.tag ch ENGLISH formula New570 Changed5400 Changed5511 The :ref:`ch` function returns the data of a given channel as a row vector. The data file is set outside the function. To access the data file the global variable ``_fi_ncid`` is used. The function should only be used inside a function for the formula interpreter. .. function:: values = ch(ssChannelName) values = ch(ssChannelName, ssBaseName) values = ch(ssChannelName, ssBaseName, bSIUnits) .. us.return **Return Value** Is a row vector with the channel values. For MDF files only the form with two parameters should be invoked. The second parameter specifies the time group the data will be interpolated to. .. us.params **Parameters** .. uparam:: ssChannelName *ssChannelName* is a channel name. .. uparam:: ssBaseName *ssBaseName* is a channel name. For MDF files the data of *ssChannelName* is interpolated to the time group of *ssBaseName*. If *ssBaseName* is not specified or an empty string ("") the data is not interpolated. .. uparam:: bSIUnits *bSIUnits* is TRUE (1), if *ssChannelName* has to be converted to SI units. If *bSIUnits* is not specified or FALSE (0) the units are not converted. .. us.example **Example** :: // Leistung in kW // M*2*PI*n // Drehzahl n in 1/min // Moment m in Nm def _fi_Power(bInfo) { ssChannels = "n_Motor, Md_Motor"; if (bInfo) { return ["Power"; .. "kW"; .. "Leistung"; .. ssChannels]; } n_Motor = ch("n_Motor"); Md_Motor = ch("Md_Motor"); Power = (n_Motor .* Md_Motor) ./ 9549.3; set_ch("Power", Power, ssChannels); } .. us.history **History** .. list-table:: :header-rows: 1 * - Version - Description * - R2013.11 - Third parameter. * - R2012 (5.40.0) - New documentation. * - 5.7 - New. .. seealso:: :ref:`formula-interpreter`, :ref:`unit-converter`, :ref:`onformulastarteval`, :ref:`set_ch`, :ref:`get_ncid`, :sub:`id-1127067`