how to fix write to excel file, it is not working
3 views (last 30 days)
Show older comments
% read from file
load('t1.mat','adatok');
t1=adatok;
t2=readmatrix("t2.csv");
% table & matrix
fiatal = ([mean(adatok.sys(adatok.kor<=50)) mean(adatok.dia(adatok.kor<=50))]);
idos = ([mean(adatok.sys(adatok.kor>50)) mean(adatok.dia(adatok.kor>50))]);
data = [idos(1), idos(2); fiatal(1), fiatal(2)];
vernyomas = table(data(:, 1), data(:, 2), 'VariableNames', {'sys', 'dia'}, 'RowNames', {'idos', 'fiatal'});
fiatal_=find(adatok.kor<=50);
s_fiatal=t2(fiatal_,:).*(power(log(t2(fiatal_,:)), 2) * 2);
idos_=find(adatok.kor>50);
s_idos=t2(idos_,:).*power(log((t2(idos_,:))+0.1), 1.5) .* cos(t2(idos_,:));
%write to file
file_name='fajlnev.xlsx';
xlswrite(file_name,s_fiatal);
% line
% adatvector
v_sys_no = adatok.sys(strcmp(adatok.nem, 'no'));
v_dia_no = adatok.dia(strcmp(adatok.nem, 'no'));
v_sys_ferfi = adatok.sys(strcmp(adatok.nem, 'ferfi'));
v_dia_ferfi = adatok.dia(strcmp(adatok.nem, 'ferfi'));
kor_no_f =NaN; % sort(adatok.kor(adatok.kor <= 50 & strcmp(adatok.nem, 'no')));
kor_no_i =NaN; %adatok.kor(adatok.kor > 50 & strcmp(adatok.nem, 'no'));
kor_no = NaN; %([kor_no_f; kor_no_i])
kor_ferfi_f =NaN; %sort(adatok.kor(adatok.kor <= 50 & strcmp(adatok.nem, 'ferfi')));
kor_ferfi_i =NaN; %sort(adatok.kor(adatok.kor > 50 & strcmp(adatok.nem, 'ferfi')));
kor_ferfi =NaN; %([kor_ferfi_f; kor_ferfi_i])
% polinoms
x = adatok.kor(strcmp(adatok.nem, 'no'));
y = adatok.sys(strcmp(adatok.nem, 'no'));
p_sys_no= polyfit(x,y,1);
x1 = adatok.kor(strcmp(adatok.nem, 'no'));
y1 = adatok.dia(strcmp(adatok.nem, 'no'));
p_dia_no= polyfit(x1,y1,1);
x2 = adatok.kor(strcmp(adatok.nem, 'ferfi'));
y2 = adatok.sys(strcmp(adatok.nem, 'ferfi'));
p_sys_ferfi= polyfit(x2,y2,1);
x3 = adatok.kor(strcmp(adatok.nem, 'ferfi'));
y3 = adatok.dia(strcmp(adatok.nem, 'ferfi'));
p_dia_ferfi= polyfit(x3,y3,1);
% figure
f = figure;
ax1 = subplot(1,2,1);
pl_sys_no = polyval( p_sys_no ,x);
pl_dia_no = polyval( p_dia_no ,x1);
fit_sys_no = plot(x,y,'bo',x,pl_sys_no,'r-');
hold on;
fit_dia_no = plot(x1,y1,'go',x1,pl_dia_no,'r-');
title('Nok','FontWeight','bold',FontSize=16)
xlabel('x',FontSize=12)
ylabel('y',FontSize=12)
xlim([24 81])
ax2 = subplot(1,2,2);
fit_sys_ferfi = polyval( p_sys_ferfi ,x2);
fit_dia_ferfi = polyval( p_dia_ferfi ,x3);
pl_sys_ferfi = plot(x2,y2,'bo',x2,fit_sys_ferfi,'r-');
hold on;
pl_dia_ferfi = plot(x3,y3,'go',x3,fit_dia_ferfi,'r-');
title('Ferfiak','FontWeight','bold',FontSize=16)
xlabel('x',FontSize=12)
ylabel('y',FontSize=12)
xlim([24 81])
0 Comments
Answers (1)
KSSV
on 31 May 2023
Moved: Image Analyst
on 31 May 2023
I would suggest to use writetable
0 Comments
See Also
Categories
Find more on Tables in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!