how to save the data in csv file from the plot
이전 댓글 표시
Hi,
I am using the code below for extracting the wanted data from few excel files then plotting the extracting data but I am unable to save the plotted data into excel file. Can you guys help, please?
Code So Far:
% To access the folder
folder = fullfile('C:','Users','muhammad','Documents','1st_Yr','Experiments_2021','performance_110');
files = dir( fullfile(folder, '*.ods') );
% Reading and extracting data from 12 excel files hence plotting
for ii = 1:length(files)
data = readmatrix(fullfile(files(ii).folder,files(ii).name), 'NumHeaderLines', 1)
x= data(:,10)
y=data(:,4)
figure(1)
% Plotting data
plot(x,y,'x','LineWidth',0.5);
hold on
end
댓글 수: 4
Walter Roberson
2021년 5월 31일
Could you explain further what you mean about saving hte plotted data into excel file? Are you asking to write a plot into Excel, so that when you went into Excel you would see the plot ?
muhammad choudhry
2021년 5월 31일
Walter Roberson
2021년 5월 31일
It sounds like you want to save them numerically.
As you are processing a number of files, how do you want the values from one file to be arranged relative to the values for another file? For example are you wanting to write each one to a separate sheet? Are you wanting to write 2 * length(files) separate columns, alternating X and Y? (If so is it possible that different files are not the same size as each other?) Are you wanting to write all of the data together as a pair of columns, all of the first file then all of the second file, and so on? If so then how do you want to mark the boundary between files? Do you want to store the file name for every row? Do you want to store a "group number" (which in this case would be ii) for each row ?
muhammad choudhry
2021년 5월 31일
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Spreadsheets에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!