write a xlsx file

2 visualizaciones (últimos 30 días)
assia assia
assia assia el 21 de Jul. de 2021
Comentada: Walter Roberson el 21 de Jul. de 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 comentarios
assia assia
assia assia el 21 de Jul. de 2021
Editada: assia assia el 21 de Jul. de 2021
data = load("data.mat")
k = struct2table(data)
writetable(k,'data.csv')
Walter Roberson
Walter Roberson el 21 de Jul. de 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.

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Más información sobre Tables en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by