File Exchange

image thumbnail

detab: a pedestrian string detabulator

version 1.0.0.0 (2.92 KB) by us
replaces TAB characters with the appropriate number of SPACE characters

1 Download

Updated 28 Mar 2006

View License

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

Cite As

us (2020). detab: a pedestrian string detabulator (https://www.mathworks.com/matlabcentral/fileexchange/10536-detab-a-pedestrian-string-detabulator), MATLAB Central File Exchange. Retrieved .

Comments and Ratings (4)

KAE

Benjamin Goudey

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?

Alexi Nedo

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

Fred Sieling

Excellent for simple strings. I haven't tried anything more.

MATLAB Release Compatibility
Created with R2006a
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!