Email: helpdesk@telkomuniversity.ac.id

This Portal for internal use only!

  • My Download
  • Checkout
Application Package Repository Telkom University
All Categories

All Categories

  • Visual Paradigm
  • IBM
  • Adobe
  • Google
  • Matlab
  • Microsoft
    • Microsoft Apps
    • Analytics
    • AI + Machine Learning
    • Compute
    • Database
    • Developer Tools
    • Internet Of Things
    • Learning Services
    • Middleware System
    • Networking
    • Operating System
    • Productivity Tools
    • Security
    • VLS
      • Windows
      • Office
  • Opensource
  • Wordpress
    • Plugin WP
    • Themes WP
  • Others

Search

0 Wishlist

Cart

Categories
  • Microsoft
    • Microsoft Apps
    • Office
    • Operating System
    • VLS
    • Developer Tools
    • Productivity Tools
    • Database
    • AI + Machine Learning
    • Middleware System
    • Learning Services
    • Analytics
    • Networking
    • Compute
    • Security
    • Internet Of Things
  • Adobe
  • Matlab
  • Google
  • Visual Paradigm
  • WordPress
    • Plugin WP
    • Themes WP
  • Opensource
  • Others
More Categories Less Categories
  • Get Pack
    • Product Category
    • Simple Product
    • Grouped Product
    • Variable Product
    • External Product
  • My Account
    • Download
    • Cart
    • Checkout
    • Login
  • About Us
    • Contact
    • Forum
    • Frequently Questions
    • Privacy Policy
  • Forum
    • News
      • Category
      • News Tag

iconTicket Service Desk

  • My Download
  • Checkout
Application Package Repository Telkom University
All Categories

All Categories

  • Visual Paradigm
  • IBM
  • Adobe
  • Google
  • Matlab
  • Microsoft
    • Microsoft Apps
    • Analytics
    • AI + Machine Learning
    • Compute
    • Database
    • Developer Tools
    • Internet Of Things
    • Learning Services
    • Middleware System
    • Networking
    • Operating System
    • Productivity Tools
    • Security
    • VLS
      • Windows
      • Office
  • Opensource
  • Wordpress
    • Plugin WP
    • Themes WP
  • Others

Search

0 Wishlist

Cart

Menu
  • Home
    • Download Application Package Repository Telkom University
    • Application Package Repository Telkom University
    • Download Official License Telkom University
    • Download Installer Application Pack
    • Product Category
    • Simple Product
    • Grouped Product
    • Variable Product
    • External Product
  • All Pack
    • Microsoft
      • Operating System
      • Productivity Tools
      • Developer Tools
      • Database
      • AI + Machine Learning
      • Middleware System
      • Networking
      • Compute
      • Security
      • Analytics
      • Internet Of Things
      • Learning Services
    • Microsoft Apps
      • VLS
    • Adobe
    • Matlab
    • WordPress
      • Themes WP
      • Plugin WP
    • Google
    • Opensource
    • Others
  • My account
    • Download
    • Get Pack
    • Cart
    • Checkout
  • News
    • Category
    • News Tag
  • Forum
  • About Us
    • Privacy Policy
    • Frequently Questions
    • Contact
Home/Matlab/Combining structs into one struct.

Combining structs into one struct.

PuTI / 2025-01-31
Combining structs into one struct.
Matlab News

Hello, I have several structs that I would like to combine together into one. The issue I find is that the data for some reasons gets completely jumbled. Each time the file runs, the columns from one struct become a part of another and I cannot figure out why

CombineGLMParam(‘2_2_2’, ‘2_3_2′,’2’)
CombineGLMParam(0, ‘2_5_1′,’2’)

function CombineGLMParam(bat1,bat2,bat)
%Combine GLM parameters by putting in the bat and the file. If bat1 is not 0, open the bat1 file and create a file GLM bat.
% If it is 0, open the GLM Bat file and append the bat 2 file to GLM.

if bat1~=0
b1=load([dirf,’Bat_’,bat1,’_GLM_Params.mat’]);
b2=load([dirf,’Bat_’,bat2,’_GLM_Params.mat’]);
b1=struct2cell(b1)
b2=struct2cell(b2)

else
b1=load([dirf,’GLM_’,bat,’.mat’]);
b2=load([dirf,’Bat_’,bat2,’_GLM_Params.mat’]);

b1=struct2cell(b1.b4)
b2=struct2cell(b2)
end

for n=1:size(b2,1)

b3{n}=[b1{n}’ b2{n}’]’;

end

Header={‘ThetaX’, ‘ThetaY’, ‘ThetaZ’, ‘Td’, ‘Vd’, ‘Vw’, ‘Hd’, ‘Hw’, ‘Ld’,’Lw’};

b4=cell2struct(b3, Header, 2)

save([dirf,’GLM_’,bat,’.mat’], ‘b4’)Hello, I have several structs that I would like to combine together into one. The issue I find is that the data for some reasons gets completely jumbled. Each time the file runs, the columns from one struct become a part of another and I cannot figure out why

CombineGLMParam(‘2_2_2’, ‘2_3_2′,’2’)
CombineGLMParam(0, ‘2_5_1′,’2’)

function CombineGLMParam(bat1,bat2,bat)
%Combine GLM parameters by putting in the bat and the file. If bat1 is not 0, open the bat1 file and create a file GLM bat.
% If it is 0, open the GLM Bat file and append the bat 2 file to GLM.

if bat1~=0
b1=load([dirf,’Bat_’,bat1,’_GLM_Params.mat’]);
b2=load([dirf,’Bat_’,bat2,’_GLM_Params.mat’]);
b1=struct2cell(b1)
b2=struct2cell(b2)

else
b1=load([dirf,’GLM_’,bat,’.mat’]);
b2=load([dirf,’Bat_’,bat2,’_GLM_Params.mat’]);

b1=struct2cell(b1.b4)
b2=struct2cell(b2)
end

for n=1:size(b2,1)

b3{n}=[b1{n}’ b2{n}’]’;

end

Header={‘ThetaX’, ‘ThetaY’, ‘ThetaZ’, ‘Td’, ‘Vd’, ‘Vw’, ‘Hd’, ‘Hw’, ‘Ld’,’Lw’};

b4=cell2struct(b3, Header, 2)

save([dirf,’GLM_’,bat,’.mat’], ‘b4’) Hello, I have several structs that I would like to combine together into one. The issue I find is that the data for some reasons gets completely jumbled. Each time the file runs, the columns from one struct become a part of another and I cannot figure out why

CombineGLMParam(‘2_2_2’, ‘2_3_2′,’2’)
CombineGLMParam(0, ‘2_5_1′,’2’)

function CombineGLMParam(bat1,bat2,bat)
%Combine GLM parameters by putting in the bat and the file. If bat1 is not 0, open the bat1 file and create a file GLM bat.
% If it is 0, open the GLM Bat file and append the bat 2 file to GLM.

if bat1~=0
b1=load([dirf,’Bat_’,bat1,’_GLM_Params.mat’]);
b2=load([dirf,’Bat_’,bat2,’_GLM_Params.mat’]);
b1=struct2cell(b1)
b2=struct2cell(b2)

else
b1=load([dirf,’GLM_’,bat,’.mat’]);
b2=load([dirf,’Bat_’,bat2,’_GLM_Params.mat’]);

b1=struct2cell(b1.b4)
b2=struct2cell(b2)
end

for n=1:size(b2,1)

b3{n}=[b1{n}’ b2{n}’]’;

end

Header={‘ThetaX’, ‘ThetaY’, ‘ThetaZ’, ‘Td’, ‘Vd’, ‘Vw’, ‘Hd’, ‘Hw’, ‘Ld’,’Lw’};

b4=cell2struct(b3, Header, 2)

save([dirf,’GLM_’,bat,’.mat’], ‘b4’) struct, structure MATLAB Answers — New Questions

​

Tags: matlab

Share this!

Related posts

External Mode Connection Issue with C2000 LaunchPad and Speedgoat System
2025-05-17

External Mode Connection Issue with C2000 LaunchPad and Speedgoat System

how to validate mscohere?
2025-05-17

how to validate mscohere?

Transfer history to MATLAB 2025a
2025-05-17

Transfer history to MATLAB 2025a

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Search

Categories

  • Matlab
  • Microsoft
  • News
  • Other
Application Package Repository Telkom University

Tags

matlab microsoft opensources
Application Package Download License

Application Package Download License

Adobe
Google for Education
IBM
Matlab
Microsoft
Wordpress
Visual Paradigm
Opensource

Sign Up For Newsletters

Be the First to Know. Sign up for newsletter today

Application Package Repository Telkom University

Portal Application Package Repository Telkom University, for internal use only, empower civitas academica in study and research.

Information

  • Telkom University
  • About Us
  • Contact
  • Forum Discussion
  • FAQ
  • Helpdesk Ticket

Contact Us

  • Ask: Any question please read FAQ
  • Mail: helpdesk@telkomuniversity.ac.id
  • Call: +62 823-1994-9941
  • WA: +62 823-1994-9943
  • Site: Gedung Panambulai. Jl. Telekomunikasi

Copyright © Telkom University. All Rights Reserved. ch

  • FAQ
  • Privacy Policy
  • Term

This Application Package for internal Telkom University only (students and employee). Chiers... Dismiss