Replace array elements with strings
古いコメントを表示
Hello,
I constructed an array out of three column vectors: Col1, Col2, v.
These Vectors are always equal in length, but the overall length can vary. Col1 and Col2 contain positive intergers 1 to 36, v is a double -1 to 1. The complete array displays corrolations between Polynomials, e.g: 1 (Col1 Index 1) and 3 (Col2 Index 1) corrolate with a value of -0.5 (v Index 1).
Since the Integers 1 to 36 identify the "Type" of a Zernike Polynomial, i want to replace them with the actual name of the Polynomial.
1 is called "Piston"
2 is called "Tilt X"
and so on .
In my array, or in the vectors, how can i change an integer element to a string, depending on it's value?
Thanks in advance!
採用された回答
その他の回答 (1 件)
I recommend using a table array to store your data of mixed types.
load patients
T = table(LastName, Age, Smoker);
head(T) % Display just the first few rows of T
LastName is a cell array containing char vectors. Age is a double array. Smoker is a logical array.
カテゴリ
ヘルプ センター および File Exchange で Tables についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
