How to save data from "dlarray" structure?????

3 ビュー (過去 30 日間)
minhyuk jeung
minhyuk jeung 2023 年 9 月 1 日
コメント済み: minhyuk jeung 2023 年 9 月 1 日
Hello I am trying to save the data from "dlarray" format.
The structure:
When trying to save this data using "xlswite" or "writematrix", it doesn't work.
Please help.
Thank you.
  2 件のコメント
Pooja Kumari
Pooja Kumari 2023 年 9 月 1 日
Can you share the data?
minhyuk jeung
minhyuk jeung 2023 年 9 月 1 日
I attached my "dlarrayfile".
Thank you for your help

サインインしてコメントする。

回答 (1 件)

Yash
Yash 2023 年 9 月 1 日
編集済み: Yash 2023 年 9 月 1 日
It seems like you're trying to save data in the "dlarray" format, which is typically used in deep learning frameworks like MATLAB's Deep Learning Toolbox. Saving data from a dlarray to a file format like XLSX (Excel) using xlswrite or writematrix might not work directly because these functions are primarily designed for simple numerical matrices or tables, not specialized data structures like dlarray.
To save data from a dlarray, you'll need to convert it into a suitable format before using xlswrite or any other file-writing function. Here are some steps you can follow:
  1. Extract Data: First, extract the numerical data from the dlarray object. You can do this using the extractdata method in MATLAB:
data = extractdata(your_dlarray);
Replace your_dlarray with the actual dlarray you want to save.
2. Convert to a Suitable Format: Convert the extracted data into a format that can be easily saved using xlswrite or writematrix. Depending on your data's structure, you might need to convert it to a numerical matrix, cell array, or table.
  • For a numerical matrix:
numerical_data = double(data);
  • For a cell array:
cell_data = num2cell(double(data));
  • For a table:
table_data = array2table(double(data));
3. Save Data: Now that you have your data in a suitable format, you can use xlswrite or writematrix to save it to an XLSX file or any other desired format:
  • For xlswrite
xlswrite('output.xlsx', numerical_data);
  • For writematrix
writematrix(numerical_data, 'output.xlsx');
Replace 'output.xlsx' with your desired file path.
Make sure to choose the format that best suits your data and intended use case (matrix, cell array, or table) before saving it. Additionally, ensure that you have the required toolbox or functions installed and included in your MATLAB environment for working with Excel files (xlswrite, writematrix, etc.)
For more information on dlarray.extractData you can refer here.
I hope this helps.
  1 件のコメント
minhyuk jeung
minhyuk jeung 2023 年 9 月 1 日
Thank you for your kindly answer.
I tried your solutions, it doesn't works well.
The result when I transform the data into "table":

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeSpreadsheets についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by