makenames

List descriptive channel or line names

Syntax

names = makenames('prefix',index)

Arguments

'prefix'

A string that constitutes the first part of the name.

index

Numbers appended to the end of prefix — any MATLAB vector syntax can be used to specify index as long as the numbers are positive.

names

An m-by-1 cell array of channel names where m is the length of index.

Description

names = makenames('prefix',index) generates a cell array of descriptive channel or line names by concatenating prefix and index.

Examples

Create the analog input object AI. You can use makenames to define descriptive names for each channel that is to be added to AI.

AI = analoginput('nidaq','Dev1');
names = makenames('chan',1:8);

names is an eight-element cell array of channel names chan1, chan2,..., chan8. You can now pass names as an input argument to the addchannel function.

addchannel(AI,0:7,names);

More About

expand all

Tips

You can pass names as an input argument to the addchannel or addline function.

If names contains more than one descriptive name, then the size of names must agree with the number of hardware channels specified in addchannel, or the number of hardware lines specified in addline.

If the channels or lines are to be referenced by name, then prefix must begin with a letter and contain only letters, numbers, and underscores. Otherwise the names can contain any character.

See Also

|

Was this topic helpful?