필터 지우기
필터 지우기

Writing variable as filename using csvwrite

조회 수: 9 (최근 30일)
B_Richardson
B_Richardson 2011년 7월 12일
Hello Community,
I have a simple problem: I am trying to use the currently selected item from a listbox as the filename in csvwrite:
indexselected = get(handles.listbox1,'Value');
list = get(handles.listbox1,'String');
itemselected = list{indexselected};
filename = intemselected;
csvwrite('filename', A);
this prints literally "filename" as the name of the file instead of the the actual contents of the variable.
Here is the matlab HELP description for csvwrite: csvwrite(filename,M) writes matrix M into filename as comma-separated values. The filename input is a string enclosed in single quotes.
Any suggestions?

채택된 답변

B_Richardson
B_Richardson 2011년 7월 12일
token = strtok(itemselected, '.')
csvwrite([token],A)
That works perfectly!

추가 답변 (1개)

Nathan Greco
Nathan Greco 2011년 7월 12일
Try writing:
csvwrite(filename,A); %without quotes
  댓글 수: 4
Oleg Komarov
Oleg Komarov 2011년 7월 12일
filename = 'RHA_RL_INC_0003_v2.59806163.avi';
csvwrite(filename,10)
will create an *.avi-names file. Check it out and replace .avi with csv.
Walter Roberson
Walter Roberson 2011년 7월 12일
Please cross-check
class(itemselected)

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Migrate GUIDE Apps에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by