disp(['counter ' num2str(blk) (here I need a tab!!!) 'adc ' num2str(adc_nr)])
Asked
Active
Viewed 1.6k times
8

Cris Luengo
- 55,762
- 10
- 62
- 120

kame
- 20,848
- 33
- 104
- 159
-
(This should have been tagged [tag:tab] and not [tag:tabs], which is about *"multiple user interface elements, e.g. browser tabs"*) – smci Feb 13 '18 at 11:40
-
There is no tab-Tag. – kame Feb 13 '18 at 12:24
-
the aliases must be acting weird. You can type 'tab' in the tag field and it's recognized as being distinct from 'tabs'. – smci Feb 13 '18 at 18:38
2 Answers
15
Try
disp(['counter ' num2str(blk) 9 'adc ' num2str(adc_nr)])
Explanation: Usually if you want to insert a tab, you put a '\t' in the string. This works well for sprintf
, but the disp
command doesn't interpret it properly. So one solution is to put the ASCII value of the tab directly, which is '9'.

smci
- 32,567
- 20
- 113
- 146

groovingandi
- 1,986
- 14
- 16
-
ASCII 009, also written as \t in more user-friendly languages... It's really nasty to see a magic 9 inside a string display command. – smci Feb 13 '18 at 11:37
0
The above answer is absolutely correct. However, here is a more readable way to do the same:
disp("counter " + blk + char(9) + "adc " + adc_nr)
Tried on MATLAB R2023a Update 2

Pratyush Kumar
- 1
- 4