필터 지우기
필터 지우기

Best way to write to a structure

조회 수: 6 (최근 30일)
Matthew
Matthew 2013년 1월 3일
I am writing a function that takes a structure composed of:
data.rawdat
data.header
and does some manipulations of the rawdat, then hopefully will write back to the structure. But this is more difficult than I thought it was. So I have structures with different filenames that are easily accessed. When I call my function:
processdata(data)
It has no problem accessing data.rawdat, no matter what the real name of my structure is. But my question is, how do I retrieve the real name of my structure and write back to it? I need to turn the variable name I input into something like:
realname.processed_data
to write the output.
Thanks for taking a look!

채택된 답변

Walter Roberson
Walter Roberson 2013년 1월 3일
No, just return something from the function.
function TheStruct = processdata(TheStruct)
....
end
and call it as
data = processdata(data)

추가 답변 (1개)

Matthew
Matthew 2013년 1월 3일
Are you kidding me? That is way too easy. Sorry to bother. Thanks.

카테고리

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

제품

Community Treasure Hunt

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

Start Hunting!

Translated by