write a xlsx file

1 visualizzazione (ultimi 30 giorni)
assia assia
assia assia il 21 Lug 2021
Commentato: Walter Roberson il 21 Lug 2021
Hello folks,
I have a mat file structed as follow and I would like to convert it to xls format.
k = load('psnr_ssim_Stokes_Double_Difference.mat')
k =
struct with fields:
psnr_value_I: [7-D double]
psnr_value_Q: [7-D double]
psnr_value_U: [7-D double]
ssim_value_I: [7-D double]
ssim_value_Q: [7-D double]
ssim_value_U: [7-D double]
I used this code but it didn't give me the content of the variables in a columns I got them in row. This is the code that I used
filename = 'psnr_ssim.xlsx'
T = table(ssim_value_I,psnr_value_I,ssim_value_Q,psnr_value_Q,ssim_value_U,psnr_value_U)
writetable(T,filename)
  12 Commenti
assia assia
assia assia il 21 Lug 2021
Modificato: assia assia il 21 Lug 2021
data = load("data.mat")
k = struct2table(data)
writetable(k,'data.csv')
Walter Roberson
Walter Roberson il 21 Lug 2021
Is "data.mat" the same file as in
save('psnr_ssim_Stokes_Linear_Seperable.mat','ssim_value_I','psnr_value_I','ssim_value_Q','psnr_value_Q','ssim_value_U','psnr_value_U')
? If so then 'ssim_value_I' is length(g_vals) by 6 other dimensions, and you have two different g_vals, so ssim_value_I would be 2 x 6 other dimensions. When you do the struct2table() the 2 x something becomes a table with two rows.
You can convert to individual variables by using splitvars(); see https://www.mathworks.com/help/matlab/ref/table.splitvars.html
... but keep in mind that you will then have a table with a lot of different columns, each of which is only 2 rows long.
I would suggest to you that you should be considering permute() and then reshape() to get the data in the order you want.

Accedi per commentare.

Risposte (0)

Categorie

Scopri di più su Tables in Help Center e File Exchange

Tag

Community Treasure Hunt

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

Start Hunting!

Translated by