Question: I want to write a csv to specific folder in matlab within a loop for multiple data sets. Outside of the loop I have: basepath

I want to write a csv to specific folder in matlab within a loop for multiple data sets. Outside of the loop I have:

basepath = 'C:\Users\Example\Desktop'

session = 'Session 1'

Fieldnames = {'Name', 'output_path', 'Age'};

Subject_info = { {'Person A', Output Folder A', 25}

{'Person B', Output Folder B', 25}

};

And in the loop I want to write a csv to the output_path location for each person (i.e csv file for person A into Output Folder A). Currently I have something like:

writecsv('person_info.csv', person_info);

The csv files are being written correctly but I do not know how to save them anywhere other than the current directory so they just overwrite each other with each iteration of the loop.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!