필터 지우기
필터 지우기

How to Call the Name of a Loaded File?

조회 수: 2 (최근 30일)
Rightia Rollmann
Rightia Rollmann 2017년 2월 18일
편집: dpb 2017년 2월 18일
I load B which is a struct as follows:
A = load( ‘B.mat’ );
How can I later access the name of file B from A? When I call A, I only get the name of all fields, but not the name of the MAT File B

채택된 답변

dpb
dpb 2017년 2월 18일
편집: dpb 2017년 2월 18일
"From A", you can't; the data stored in a .mat file are totally independent of the (root) name given the file when it was created. The only way to create a connection would be to add another variable or field in the structure that contains the filename you're going to use when SAVE the data. Of course, this runs the risk you don't update the field correctly or at all, so it's not a sure-fire method, either.
What's the problem you're actually trying to solve? If you have 'b.mat' to load the file, what's to keep from creating the link from that information to do whatever it is that you wish to do?
But the upshot is, there is nothing within a standard .mat file than the variables written to it; if you don't add information within the file if the filename that was used to load it is somehow lost it can't be told which file it was.

추가 답변 (0개)

카테고리

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by