How to replace the empty cells in a cell array by a 4-bits string?
58 views (last 30 days)
Show older comments
Hello,
How to replace the empty cells " [ ] " in the attached matrix to a 4-bits string we can convert the whole array matrix to double.
For example,
if we have thw following row:
[ '0001', '0101' , '1010', [ ], [ ], [ ], '1111']
it becomes:
[0,0,0,1,0,1,0,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1]
0 Comments
Accepted Answer
Akira Agata
on 19 Jan 2020
How about the following?
load('Key.mat');
idx = cellfun(@isempty,Key); % Find the indexes of empty cell
Key(idx) = {'0000'}; % Replace the empty cells with '0000'
See Also
Categories
Find more on Matrix Indexing in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!