Using Guide, export a code to a .txt file HELP HEL HELP
Show older comments
Hey guys, I want to export this code to a txt file when I pressed a push button in guide:
cblock
cuenta1
cuenta2
cuenta3
endc
p equ d'66'
m equ d'100'
n equ d'100'
retardo
movlw p
movwf cuenta1
dec1
movlw m
movwf cuenta2
dec2
movlw n
movwf cuenta3
dec3
decfsz cuenta3
goto dec3
decfsz cuenta2
goto dec2
decfsz cuenta1
goto dec1
return
thank you very much,
1 Comment
KSSV
on 11 Apr 2017
Where is this code given to export?
Answers (1)
Walter Roberson
on 11 Apr 2017
S = { 'cblock '
'cuenta1'
'cuenta2'
'cuenta3'
'endc'
''
'p equ d''66'' '
'm equ d''100'' '
'n equ d''100'' '
'retardo'
'movlw p'
'movwf cuenta1 '
'dec1'
'movlw m'
'movwf cuenta2 '
'dec2'
'movlw n'
'movwf cuenta3 '
'dec3'
'decfsz cuenta3 '
'goto dec3 '
'decfsz cuenta2'
'goto dec2'
'decfsz cuenta1'
'goto dec1'
'return' };
fid = fopen('NameOfOutputFile', 'wt');
fprintf(fid, '%s\n', S{:});
fclose(fid);
Are you certain that you want the trailing blanks on lines? You do not appear to have used trailing blanks in a consistent manner.
2 Comments
Javier Lagunas
on 11 Apr 2017
Walter Roberson
on 11 Apr 2017
fid = fopen('NameOfOutputFile', 'wt');
fprintf(fid, 'Hello World\nMy name is: ''%s''\n', NameUserGave);
Categories
Find more on Cell Arrays 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!