Here's how you'd create a structure in MATLAB:
» Case.Name = 'Jack';» Case
Case =» whos
Name Size Bytes Class
Case 1x1 434 struct array
Grand total is 34 elements using 434 bytesHere's how you'd do it in C:
#include
struct Case { char Name[100]; int CaseID; char CaseStatus[100]; }; void main( ) { char *dummyname = {"Jack"}; int dummyid = 123456; char *dummystatus = {"Open-Pending Research"}; struct Case *MyCase; MyCase = (struct Case *)malloc(sizeof(struct Case)); strcpy(MyCase->Name, dummyname); MyCase->CaseID = dummyid; strcpy(MyCase->CaseStatus, dummystatus); printf("Contact Name: %s\n", MyCase->Name); printf("Case ID : %d\n", MyCase->CaseID); printf("Case Status : %s\n", MyCase->CaseStatus); free(MyCase); }
Let's take a closer look at the above C-code