Effacer les filtres
Effacer les filtres

how to solve this issue?

1 vue (au cours des 30 derniers jours)
vijay chandra
vijay chandra le 17 Oct 2017
Commenté : vijay chandra le 17 Oct 2017
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)

Réponse acceptée

Guillaume
Guillaume le 17 Oct 2017
Modifié(e) : Guillaume le 17 Oct 2017
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 commentaire
vijay chandra
vijay chandra le 17 Oct 2017
I will get structures as I told like above. Thank you Guillaume. Your commands helped me to get what I want exactly.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Structures dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by