You are now following this Submission
- You will see updates in your followed content feed
- You may receive emails, depending on your communication preferences
The built-in 'UNIQUE' function in MATLAB will report errors if the input cell contains different types of variables.
% This function 'uniqueStrCell' performs 'UNIQUE' for cell array of string.
% The output cell 'out' will include only string cells and numeric cells converted to strings
% , and exclude NaN and empty cells.
% Example:
% inputStrCell={'ek','wekf', 29, NaN, [],'we'};
% out = uniqueStrCell(inputStrCell);
% >> out = {'ek' 'we' 'wekf' '29'}
%
% Acknowledgement:
% This function greatly benefits from Jan Simon's comments. The previous version was errorful.
% See 'unique' for more information
Cite As
Wei-Rong Chen (2026). Unique for cell array of string (https://in.mathworks.com/matlabcentral/fileexchange/50476-unique-for-cell-array-of-string), MATLAB Central File Exchange. Retrieved .
General Information
- Version 1.1.0.0 (1.05 KB)
MATLAB Release Compatibility
- Compatible with any release
Platform Compatibility
- Windows
- macOS
- Linux
| Version | Published | Release Notes | Action |
|---|---|---|---|
| 1.1.0.0 | Update greatly benefits from Jan Simon's comments. |
||
| 1.0.0.0 |
|
