open file in notepad via gui

23 visualizaciones (últimos 30 días)
Fiboehh
Fiboehh el 21 de Abr. de 2011
Hellow, i search a method to open a file in notepad or another simple txt reader from a gui. So my code generates a ascii file and if i push a button the file have to open notepad. my ascii file is: a = sinogram.sin;
if have found open('a');
but then it opens in matlab itself. Thx

Respuesta aceptada

Paulo Silva
Paulo Silva el 21 de Abr. de 2011
Example:
!notepad C:\Program Files\MyFolder\textFile.txt
Just replace that path with your own.

Más respuestas (2)

Fiboehh
Fiboehh el 21 de Abr. de 2011
Okj that works but know i want to pick a .sin file out of a load window. You know how to do that? i tried
m = uigetfile('*.sin','Select the .sin-file');
!notepad m
but that didnt work! I need something to read out the file and then to open it. Thx a lot
  3 comentarios
Paulo Silva
Paulo Silva el 21 de Abr. de 2011
The way you call uigetfile is wrong
[FileName,PathName] = uigetfile('*.sin','Select the .sin-file')
eval(['!notepad ' PathName FileName])
Paulo Silva
Paulo Silva el 21 de Abr. de 2011
And another way for those who hate the eval function
system(['notepad ' PathName FileName])

Iniciar sesión para comentar.


Fiboehh
Fiboehh el 21 de Abr. de 2011
Okj thx so much paulo,
[FileName,PathName] = uigetfile('*.sin','Select the .sin-file')
eval(['!notepad ' PathName FileName])
works, but when the load window opens and if i click on annulate, there opens an empty notepad window and thats not the goal :) hope you have something to fix that.
  1 comentario
Paulo Silva
Paulo Silva el 21 de Abr. de 2011
[FileName,PathName] = uigetfile('*.sin','Select the .sin-file')
if ischar(FileName)
%disp('file selected')
eval(['!notepad ' PathName FileName])
else
%disp('user canceled')
end

Iniciar sesión para comentar.

Categorías

Más información sobre Environment and Settings en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by