How do I copy a .csv file from any specified folder to the working directory where matlab is run from?

조회 수: 1 (최근 30일)
I have been looking in your previous collections of Answers but have not found what I need for my situation. I will be creating an executable file of my script which can be run on any computure without the need of a Matlab license and will most likely reside on an aircraft where telemetry data collection occurs and multiple binary files are generated into multiple folders and subfolders which are named differently depending on flight and date. My script will convert these binary files into csv files but I don't know how to copy the csv files into the folder where my executable file will run from to read in data and perform data analysis. Can you please help with this question?
  댓글 수: 1
Stephen23
Stephen23 2018년 6월 8일
편집: Stephen23 2018년 6월 8일
Why do you need to do this? Why not just provide the full filepath?
All MATLAB functions accept absolute/relative filepaths. Using the full filepath is much more efficient than duplicating your data files around the place or changing the current directory.

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

채택된 답변

Fangjun Jiang
Fangjun Jiang 2018년 6월 8일
copyfile(source, destination) where source and destination can be full path of the file.
pwd() will get you the current folder.
  댓글 수: 4
Supriya Gain
Supriya Gain 2022년 5월 17일
I have a folder which contains: .csv, .XLS , .xlsx files. Now I just want to copy .CSV files from that folder to a separate folder. How to do that using MATLAB
Fangjun Jiang
Fangjun Jiang 2022년 5월 17일
편집: Fangjun Jiang 2022년 5월 17일
From the doc of copyfile()
File or folder to copy, specified as a character vector or string scalar. To copy multiple files or folders, use wildcards (*).
Or see uigetfile(), uiputfile()

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

추가 답변 (1개)

Thomas Gunther
Thomas Gunther 2018년 6월 8일
Okay, thanks. I will give it a go and see if that works.

카테고리

Help CenterFile Exchange에서 Environment and Settings에 대해 자세히 알아보기

태그

제품


릴리스

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by