필터 지우기
필터 지우기

how to writetable to specifc folder

조회 수: 137 (최근 30일)
Jelthe
Jelthe 2016년 3월 23일
댓글: Jelthe 2016년 3월 23일
Hello,
iam really new to Matlab and i want to write a table to another folder than the maindirectory. My code so far:
meanVal=[1,2,3,4];
X_mean_vect=[5,6,7,8];
average_pulsduration= meanVal';
Event_number= X_mean_vect' ;
T = table(average_pulsduration,Event_number)
my_directory = 'D:\PPL Server Programme\_Last Version 20150526\MATLAB\Pulsduration table';
Pulsdauer = [my_directory '.txt'];
writetable(T,Pulsdauer);
The outcome is, it still saves the .txt in the mainfolder with the name Pulsduration table.
i tried so much things, but i cant figure out how to save it into th FOLDER pulsduration table
thanks

답변 (1개)

Adam
Adam 2016년 3월 23일
편집: Adam 2016년 3월 23일
You have to give your file a name. You do:
my_directory = 'D:\PPL Server Programme\_Last Version 20150526\MATLAB\Pulsduration table';
Pulsdauer = [my_directory '.txt'];
Which simply appends .txt to what you intend as a directory path, but when it interprets this it assumes that the 'Pulsduration table' must be the filename since it has .txt appended to it. So you want e.g.
my_directory = 'D:\PPL Server Programme\_Last Version 20150526\MATLAB\Pulsduration table';
Pulsdauer = [my_directory 'SomeFileName.txt'];
  댓글 수: 3
Adam
Adam 2016년 3월 23일
Ah yes, I just edited your current solution rather than what I tested:
Pulsdauer = fullfile( my_directory, 'SomeFileName.txt'] );
or
Pulsdauer = [my_directory filesep 'SomeFileName.txt'];
should work
Jelthe
Jelthe 2016년 3월 23일
Well it worked. Thanks.

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

카테고리

Help CenterFile Exchange에서 Tables에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by