필터 지우기
필터 지우기

Loading table from object from .mat file

조회 수: 2 (최근 30일)
Saeid
Saeid 2024년 4월 6일
댓글: Stephen23 2024년 4월 7일
I import a table object that I have stored in a .mat file (attachment) using:
ParaDat=load('ParameterDatabase.mat')
Then, I try to assign values to the different elements of that table, e.g.
A1=ParaDat.a1
but this line generates the error message: Unrecognized field name "a1"
Also, if I try to convert the imported struct to a table using:
Dat=struct2table(ParaDat)
A1=Dat.a1
but I wtill see the same error message. How can I address the different variables of the imported table?
  댓글 수: 3
Saeid
Saeid 2024년 4월 7일
OK, thanks, Stephen, but why should I NOT load directly into the workspace?
Stephen23
Stephen23 2024년 4월 7일
"why should I NOT load directly into the workspace?"
For most of the reasons listed here:

댓글을 달려면 로그인하십시오.

채택된 답변

Fangjun Jiang
Fangjun Jiang 2024년 4월 6일
If the table object in that .mat file is called MyTable, then after ParaDat=load('ParameterDatabase.mat'), you can access it by
ParaDat.MyTable
If you run load('ParameterDatabase.mat'), then you can access that table directly
MyTable

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Tables에 대해 자세히 알아보기

제품


릴리스

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by