필터 지우기
필터 지우기

how to solve this issue?

조회 수: 1 (최근 30일)
vijay chandra
vijay chandra 2017년 10월 17일
댓글: vijay chandra 2017년 10월 17일
Log_name=strtrim(['ArxmlLog.Struct_Pdus.',strcat('Struct_Pdu',num2str(pduCount))]);
If I use this line I will get structure like Struct_Pdu_1
But I want to get like this Struct_Pdu.(1)
Struct_Pdu_1 ====> Struct_Pdu.(1)
Instead of _1 =====> .(1)

채택된 답변

Guillaume
Guillaume 2017년 10월 17일
편집: Guillaume 2017년 10월 17일
If I use this line I will get structure like Struct_Pdu_1
a) you don't get a structure at all, you get a char array (with the word struct in it).
b) what you get is of the form ArxmlLog.Struct_Pdus.Struct_Pdu1, no _ between Pdu and the number.
c) that's a needlessly complicated syntax, we have an strtrim that has nothing to strim and a redundant strcat that does the same as the [] it's embedded in.
I'm not sure what you're trying to do. If you are trying to create a char array, then:
Log_Name = sprintf('ArxmlLog.Struct_Pdus.Struct_Pdu(%d)', pduCount);
would be one way. Possibly, the 2nd Struct_Pdu is supposed to come from a variable, in which case:
fname = 'StructPdu';
Log_Name = sprintf('ArxmlLog.Struct_Pdus.%s(%d)', fname, pduCount);
  댓글 수: 1
vijay chandra
vijay chandra 2017년 10월 17일
I will get structures as I told like above. Thank you Guillaume. Your commands helped me to get what I want exactly.

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

추가 답변 (0개)

카테고리

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