61 views (last 30 days)

Show older comments

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

KALYAN ACHARJYA
on 31 May 2021

Edited: KALYAN ACHARJYA
on 31 May 2021

Options:

- The plot is a figure, you can save as Matlab .fig files (Use save as option)
- Save the figure plot result as an image (imwrite)
- If you wish to save x & y numeric data, create a vector as follows & save using writematrix function (Excel/CSV)

result=[x_column_data,y_column_data]

writematrix(result,......) %see the write matrix Matlab Doc

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

Start Hunting!