DETAB replaces TAB characters with the appropriate number of SPACE characters from the contents of a file or a cell array (containing strings) such that the absolute position of text entries is preserved.
This is particularly useful for populating UICONTROLs (eg, listboxes) with the contents of files or strings that contain TABs
see
> help detab
for explanations and the accompanying image for an example
us (2021). detab: a pedestrian string detabulator (https://www.mathworks.com/matlabcentral/fileexchange/10536-detab-a-pedestrian-string-detabulator), MATLAB Central File Exchange. Retrieved .
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Create scripts with code, output, and formatted text in a single executable document.
@KAE: This is the documented behavior. If the input is a CHAR vector, it is used as file name to import a file.
New problems in R2020a,
detab({'a\tb'})
ans =
1×1 cell array
{'a\tb'}
detab('a\tb')
DETAB> file not found <>
ans =
[]
Useful for getting tabs in legends, see example here,
https://www.mathworks.com/matlabcentral/answers/353231-how-can-i-use-tabs-in-legend-text
I've been unable to get this function working as expected.
tab_table=sprintf('a\tb\na\tc');
disp(tab_table)
%a b
%ab c
detab_table=detab({tab_table});
disp(detab_table{1})
%a b
%ab c <-this row is misaligned
Could anyone point out if my usage or assumptions
about this function are correct?
One Interesting Point:
Search for the tab (\t) character in a string.
1- findstr (str, '\t') --> does NOT Work
2- tab = sprintf('\t');
findstr(str, s) --> Works
Excellent for simple strings. I haven't tried anything more.