About Site Map Submit Contact Us Log in | Create an account
Create an account Log In
Average Rating
User Rating:
Visitors Rating:
My rating:

Write review
See full specifications

scripts default iconisValidSymbol (Scripts) Publisher's description

ISVALIDSYMBOL - Check string to be a valid Matlab symbol

ISVALIDSYMBOL - Check string to be a valid Matlab symbol

This function is equivalent to Matlab's ISVARNAME, but accepts cell strings as input also. While the speed is comparable for strings, it is *much* faster for cell strings (see screenshot).

L = isValidSymbol(S)
S: String or cell string.
L: LOGICAL scalar, if S is a string. LOGICAL array of the same size
as S for a cell string.
L is TRUE for valid symbols:
The 1st character must be a letter, the following must be a letter,
number or the underscore. The length must not exceed 63 characters.

isValidSymbol('a') % >> true
isValidSymbol('a1') % >> true
isValidSymbol('a_') % >> true
isValidSymbol({'_a', 'b'}) % >> [false, true]
isValidSymbol('1a') % >> false
s = repmat('a', 1, 63);
isValidSymbol(s) % >> true
isValidSymbol([s, 'a']) % >> false

Actually the C subfunction "CheckCString" was developed to support the safe creation of structs and MAT files in C-Mex functions. You can easily include the test to your Mex-projects - just remove the main function "mexFunction".

For checking Matlab strings the conversion to a C-string wastes time. Therefore the subfunction "CheckMatlabString" operates on the mxChar-vector directly.
You can accelerate Matlab's slow GENVARNAME remarkably by calling this function instead of a loop over ISVARNAME calls.

System Requirements:

MATLAB 7.8 (R2009a)
Program Release Status: New Release
Program Install Support: Install and Uninstall

isValidSymbol (Scripts) Tags:

Click on a tag to find related softwares

Is isValidSymbol (Scripts) your software?

Manage your software

Most Popular

scripts default icon ASK, OOK, FSK, BPSK, QPSK, 8PSK modulation 1.1
ASK, OOK, FSK, BPSK, QPSK, 8PSK modulation contain several functions for digital modulation simulation
scripts default icon Simulink Communication Labs 1.1
Simulink Communication Labs allows you to learn communication systems in greater depth.
scripts default icon M-QAM modulation and demodulation 1.1
M-QAM modulation and demodulation is the QAM modulation and demodulation tech.
scripts default icon LZW Compression/Decompression 1.1
LZW Compression/Decompression - Updated LZW compressor and decompressor with reasonable performance
scripts default icon InSPIRE utility to plot a 2D displacement field (Scripts) 1.0
This program plots the deformation field (displace vectors) contained in vector.txt.