Problems handling strings in save command

Problems handling strings in save command

Post by Fernán Mateo » Fri, 07 Nov 2003 18:57:26



Hi!

I would like to save a variable in a file named as indicated by the user
with the command "uiputfile". This command returns filename and pathname.
The problem is that I don't know how to send this name to the 'save'
command.

I've tried as indicated below, but it doesn't work:

--------------------------------------------------
[filename, pathname, filterindex] = uiputfile( ...
       {'*.txt','Ficheros de texto (*.txt)'}, ...
        'Guardar como', 'sintitulo.txt');

save sprintf('%s',[pathname filename]) datos -ASCII; ---> DOESN'T WORK!
--------------------------------------------------

Any ideas?

Thank you very much in advance!

Fernn.

 
 
 

Problems handling strings in save command

Post by Titus Edelhofe » Fri, 07 Nov 2003 19:59:44


Hi Fernan,
use the function call of save:
save([pathname filename], 'datos', '-ascii')

Titus


Quote:> Hi!

> I would like to save a variable in a file named as indicated by the user
> with the command "uiputfile". This command returns filename and pathname.
> The problem is that I don't know how to send this name to the 'save'
> command.

> I've tried as indicated below, but it doesn't work:

> --------------------------------------------------
> [filename, pathname, filterindex] = uiputfile( ...
>        {'*.txt','Ficheros de texto (*.txt)'}, ...
>         'Guardar como', 'sintitulo.txt');

> save sprintf('%s',[pathname filename]) datos -ASCII; ---> DOESN'T WORK!
> --------------------------------------------------

> Any ideas?

> Thank you very much in advance!

> Fernn.