필터 지우기
필터 지우기

How i can form Array List

조회 수: 47 (최근 30일)
SAMEER ahamed
SAMEER ahamed 2014년 2월 17일
댓글: SAMEER ahamed 2014년 2월 22일
Hi,
I am new for mat-lab , how i can want to make Array List form ? below example
for int i=1:20
X = 1;
Y=2;
X1 =4;
Y2 =5;
X2 =6;
Y2 =7;
end
Output i would like to store like : matrix =[[1,2],[4,5],[6,7]];

채택된 답변

Walter Roberson
Walter Roberson 2014년 2월 17일
MATLAB does not have array lists exactly like that. It has cell arrays which are similar.
matrix = {[X Y]; [X1 Y1]; [X2 Y2]}
  댓글 수: 7
SAMEER ahamed
SAMEER ahamed 2014년 2월 20일
편집: SAMEER ahamed 2014년 2월 20일
thank's for reply me , now i have got result like ?
if true
% code
for i=1:2
disp(matrix{1,i}); %here matrix{1,i}=[left_distance_X, left_distance_Y, right_distance_X, right_distance_Y, upper_distance_X, upper_distance_Y, right_distance_Y, bottom_distance_Y];
%Here result -1 like Matrix
30
23
77
23
53
8
53
35
%Here result-2 like
31
25
72
25
46
15
46
42
%Here I have tried up to int child node ,after looping of every 1-by-8 matrix
dt = datestr(now,'mm-dd-yy-HH:MM:SS.FFF-AM');
combinedStr = strcat('Hello',dt);
disp(combinedStr);
docNode = com.mathworks.xml.XMLUtils.createDocument('lipreading');
docRootNode = docNode.getDocumentElement;
thisElement = docNode.createElement('id');
thisElement.appendChild(docNode.createTextNode(combinedStr));
docRootNode.appendChild(thisElement);
matrix_thisElement = docNode.createElement('matrix');
vector_thisElement = docNode.createElement('vector');
left_int_thisElement = docNode.createElement('int');
*%Here I would like to call Looping stored each 1-by-8 matrix values*
docRootNode.appendChild(left_int_thisElement);
docRootNode.appendChild(vector_thisElement);
docRootNode.appendChild(matrix_thisElement);
xmlFileName =['tempname','.xml'];
xmlwrite(xmlFileName,docNode);
edit(xmlFileName);
end
end
*Note : I would like to write XML to form like below ?*
if true
% code
<vector>
<int>3</int>
<int>-99</int>
<int>-6</int>
<int>79</int>
<int>-195</int>
<int>11</int>
<int>197</int>
<int>8</int>
</vector>
<vector>
<int>4</int>
<int>-99</int>
<int>-5</int>
<int>79</int>
<int>-195</int>
<int>12</int>
<int>196</int>
<int>9</int>
</vector>
<vector>
end
SAMEER ahamed
SAMEER ahamed 2014년 2월 22일
Hi,
I am new for matlab , now i have 10 frames video file , each frame values i need to stored in xml file ?
I have Matlab Code Below like :
for i=1:10
matrix{1,i}=[leftx,lefty,rightx,righty,uppertx,uppery,bottomx,bottomy];%1-by-8 matrix
end
Below format i want to stored values please let me know how i can format like ?
example :
<reading>
<id>id1</id>
<matrix class="vector">
<vector>
<int>2</int>
<int>1</int>
<int>44</int>
<int>45</int>
<int>42</int>
<int>24</int>
<int>14</int>
<int>84</int>
</vector>
<vector>
<int>7</int>
<int>31</int>
<int>674</int>
<int>455</int>
<int>2</int>
<int>24</int>
<int>4</int>
<int>84</int>
</vector>
</matrix>
</reading>

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Structured Data and XML Documents에 대해 자세히 알아보기

태그

아직 태그를 입력하지 않았습니다.

Community Treasure Hunt

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

Start Hunting!

Translated by