How to store words and numbers table in an array
이전 댓글 표시
can anyone help me to create an empty array to store a 11 x 3 string array.
I am rating a loop to store each value for every image. i have to loop i just can't create a suitable array to store the words and numbers. This is what each image gives out:
"Sky" "268032" "786432"
"Building" "0" "0"
"Pole" "131" "786432"
"Road" "734" "786432"
"Pavement" "7610" "786432"
"Tree" "7450" "786432"
"SignSymbol" "7082" "786432"
"Fence" "5490" "786432"
"Car" "6912" "786432"
"Pedestrian" "3669" "786432"
"Bicyclist" "9836" "786432"
Thanks.
댓글 수: 12
Benjamin Currie
2021년 4월 7일
Adam Danz
2021년 4월 7일
Why are you using categorical variables and tables when you've requested to make a string array in the question? Perhaps the goal is evolving in which case it would be a good idea to resolidify the goal.
Benjamin Currie
2021년 4월 7일
Benjamin Currie
2021년 4월 7일
Adam Danz
2021년 4월 7일
Do either of the answers below satisfy that request?
Why not just keep the table rather than storing the values in an array?
Benjamin Currie
2021년 4월 7일
But the question asks " can anyone help me to create an empty array to store a 11 x 3 string array"
The comment above is a completely different goal.
" I need to store each table in the same array under each other"
If the tables have the same headers you could vertically concatenate the tables. Otherwise you can store them in a Cell array.
Benjamin Currie
2021년 4월 7일
Benjamin Currie
2021년 4월 7일
Benjamin Currie
2021년 4월 8일
Adam Danz
2021년 4월 8일
They are just indices.
n and m are defined in my comment (".... for nxm empty cell array).
i and j are just indices. c(i,j) is the i_th row and the j_th column.
답변 (1개)
David Hill
2021년 4월 7일
Why not set up a struct?
s = struct('a',{},'b',{},'c',{});%label the fields to whatever you want
for k=1:11
s(k).a=%'Building' from picture
s(k).b=%268032
s(k).c=%786432
end
카테고리
도움말 센터 및 File Exchange에서 Data Types에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!