From: Steven_Lord on


"us" <us(a)neurol.unizh.ch> wrote in message
news:cce8fe51-938f-49c9-a59f-1d0361ccd711(a)q2g2000vbd.googlegroups.com...
> On Jul 27, 10:29 pm, "chinedu " <chinedu.ok...(a)nyumc.org> wrote:
>
>> Section I need help in
>> contents = get(handles.listbox1,'String');
>> %pathname = contents{get(handles.listbox1,'Value')};
>> fnam='anew.txt';
>> com=fprintf('notepad %s',fnam);
>> fprintf(contents);
>> % fid=fopen(savename, 'w');
>> % for i=1:length(logfile)
>> % cell=cell2mat(logfile(1,i));
>> % fprintf(fid, '%s\r\n', cell)
>> % end
>> system(com);
>>
>> all it does is just opens a notepad but does not display the contents of
>> the listbox
>
> how could this possibly work(?!)...
> you're NEVER writing anything into anything...

If the OP uncommented the FOPEN/FPRINTF lines this looks at first glance
like it would work ... but they need to FCLOSE the file before opening it in
Notepad. I would also recommend opening the file using either the MATLAB
Editor (using EDIT) or Wordpad instead of Notepad. As this group has
discussed occasionally, Notepad doesn't play very well with line endings.

--
Steve Lord
slord(a)mathworks.com
comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ
To contact Technical Support use the Contact Us link on
http://www.mathworks.com

From: chinedu on

sorry i copied the wrong part. Here is the correct part

contents = get(handles.listbox1,'String');
fnam='anew.txt';
com=sprintf('notepad %s',fnam);
fid = fopen(fnam,'w');
for i = 1:length(contents)
fprintf(fid,'%s\r\n',char(contents(i)));
end
system(com);
contents
fclose(fid);


So far it list the contents of the listbox, but how do i have it list when the playlist is randomly playing the contects of the list in notepad