Change 3x1 double to 1x3 double and convert it to a string to insert in text correctly
조회 수: 4 (최근 30일)
이전 댓글 표시
Hi
I have following array which contains of 3x1 double:
I'd like to convert it to a string and insert it into a text with strcat which only works with strings.
for k = 1:size(Polygons,2)
Color_Interpolated{k} = num2str(Color_Interpolated{k});
end
Unfortunately, my string looks now like this:
How can I change this to a 1x3 double that the eventual output is like 0 0.667 0.667 ? I need to convert it later to a string.
Below I combine all the strings together, and I need to transpose it to match the dimensions. I used reshape too, with the same results.
for k = 1:size(Polygons,2)
Complete_File{k} = strcat(Shape, Color_Interpolated{k});
Complete_File{k} = transpose(Complete_File{k});
Complete_File{k} = strcat(Complete_File{k}, Geometry,...
Assoc_Polygons{k}, coordIndex);
end
Complete_File_table = cell2table(Complete_File);
writetable(Complete_File_table,'Test.txt');
The text file looks now like this:
Shape
{
appearance Appearance {
material Material {
Color 0 }
}
geometry IndexedFaceSet
So the color is not inserted correctly, I think if the cells in Color_Interpolated are correct the text insert will be correct too.
Best regards
댓글 수: 0
답변 (1개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Characters and Strings에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!