Grabbing the first position in cell within a structure
2 ビュー (過去 30 日間)
古いコメントを表示
Hello all,
I'm attempting to grab the first, second, third and then fourth position of a vector, where each row representing a different object has a 1X4 cell; object . How could i do this using a for loop?
I currently have the vector within a struct (outputTableExport), object= [5 6 5 8; 9 6 4 3; 9 8 5 2] ect.... im trying to create a varables utalizing matlabs 'patch' function to turn 'object' into something like this: newVariable = [5 9 9];[6 6 8];[5 4 5];[8 3 2]. In this example is would be turning this nX4 into a 4Xn where n = the number of objects. The code below is what ive tried so far.
Any help or guidance would be appreciated.
for iRun = 1:1:length(outputTableExport)
for iObj = 1:1:length(outputTableExport(iRun).tubingRuns)
xArrayObject{1,iObj} = outputTableExport(iRun).tubingRuns(iObj).xArray(1);
yArrayObject(1,iObj) = outputTableExport(iRun).tubingRuns(iObj).yArray(1);
xArrayObject{2,iObj} = outputTableExport(iRun).tubingRuns(iObj).xArray(2);
yArrayObject(2,iObj) = outputTableExport(iRun).tubingRuns(iObj).yArray(2);
xArrayObject{3,iObj} = outputTableExport(iRun).tubingRuns(iObj).xArray(3);
yArrayObject(3,iObj) = outputTableExport(iRun).tubingRuns(iObj).yArray(3);
xArrayObject{4,iObj} = outputTableExport(iRun).tubingRuns(iObj).xArray(4);
yArrayObject(4,iObj) = outputTableExport(iRun).tubingRuns(iObj).yArray(4);
end
end
0 件のコメント
採用された回答
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Resizing and Reshaping Matrices についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!