how to save the data in csv file from the plot

조회 수: 127(최근 30일)
muhammad choudhry
muhammad choudhry 2021년 5월 31일
댓글: Walter Roberson 2021년 5월 31일
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)
% Plotting data
hold on
  댓글 수: 4
muhammad choudhry
muhammad choudhry 2021년 5월 31일
I want to write the data in the following format:
column 4 and 10 from the file one
then column 4 and 10 from file 2
all them columns need to be saved into one separate file(in one sheet), column by column (column data are not of same size, they are different in length), yes all the data as a pair of column all of the first then second correct and so on correct!. Well, for now I do not need to mark the boundary between each file because they are random point generated using experimental trials and moving forward I want to fit the LOWESS estimation curve to them to see how well or close them points to each other.

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

채택된 답변

KALYAN ACHARJYA 2021년 5월 31일
편집: KALYAN ACHARJYA 2021년 5월 31일
  1. The plot is a figure, you can save as Matlab .fig files (Use save as option)
  2. Save the figure plot result as an image (imwrite)
  3. If you wish to save x & y numeric data, create a vector as follows & save using writematrix function (Excel/CSV)
writematrix(result,......) %see the write matrix Matlab Doc
  댓글 수: 2
Walter Roberson
Walter Roberson 2021년 5월 31일
You can use 'writemode', 'append' for writematrix()

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

추가 답변(0개)

Community Treasure Hunt

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

Start Hunting!

Translated by