cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Learn all about PTC Community Badges. Engage with PTC and see how many you can earn! X

Passing '3d' nested matrixes to Matlab

Philip.Oakley
7-Bedrock

Passing '3d' nested matrixes to Matlab

Does anyone have any method for passing nested '3d' matrixes from MathCAD to Matlab?

I'm needing it for passing on to another bit of code.

For example a .prn file reader that, in matlab, will parse the MathCAD saved .prn file format?

Philip

A partial example (with missing line breaks 'cos the thread interface don't work..)

// Datafile written by Mathcad // 07/15/11 14:10:29 .MATRIX 0 0 128 1 {1,0,32,32} {2,0,32,32} {3,0,32,32} {4,0,32,32} {5,0,32,32} {6,0,32,32} {7,0,32,32} {8,0,32,32} {9,0,32,32} {10,0,32,32} {11,0,32,32} {12,0,32,32} {13,0,32,32} {14,0,32,32} {15,0,32,32} {16,0,32,32} {17,0,32,32} {18,0,32,32} {19,0,32,32} {20,0,32,32} {21,0,32,32} {22,0,32,32} {23,0,32,32} {24,0,32,32} {25,0,32,32} {26,0,32,32} {27,0,32,32} {28,0,32,32} {29,0,32,32} {30,0,32,32} {31,0,32,32} {32,0,32,32} {33,0,32,32} {34,0,32,32} {35,0,32,32} {36,0,32,32} {37,0,32,32} {38,0,32,32} {39,0,32,32} {40,0,32,32} {41,0,32,32} {42,0,32,32} {43,0,32,32} {44,0,32,32} {45,0,32,32} {46,0,32,32} {47,0,32,32} {48,0,32,32} {49,0,32,32} {50,0,32,32} {51,0,32,32} {52,0,32,32} {53,0,32,32} {54,0,32,32} {55,0,32,32} {56,0,32,32} {57,0,32,32} {58,0,32,32} {59,0,32,32} {60,0,32,32} {61,0,32,32} {62,0,32,32} {63,0,32,32} {64,0,32,32} {65,0,32,32} {66,0,32,32} {67,0,32,32} {68,0,32,32} {69,0,32,32} {70,0,32,32} {71,0,32,32} {72,0,32,32} {73,0,32,32} {74,0,32,32} {75,0,32,32} {76,0,32,32} {77,0,32,32} {78,0,32,32} {79,0,32,32} {80,0,32,32} {81,0,32,32} {82,0,32,32} {83,0,32,32} {84,0,32,32} {85,0,32,32} {86,0,32,32} {87,0,32,32} {88,0,32,32} {89,0,32,32} {90,0,32,32} {91,0,32,32} {92,0,32,32} {93,0,32,32} {94,0,32,32} {95,0,32,32} {96,0,32,32} {97,0,32,32} {98,0,32,32} {99,0,32,32} {100,0,32,32} {101,0,32,32} {102,0,32,32} {103,0,32,32} {104,0,32,32} {105,0,32,32} {106,0,32,32} {107,0,32,32} {108,0,32,32} {109,0,32,32} {110,0,32,32} {111,0,32,32} {112,0,32,32} {113,0,32,32} {114,0,32,32} {115,0,32,32} {116,0,32,32} {117,0,32,32} {118,0,32,32} {119,0,32,32} {120,0,32,32} {121,0,32,32} {122,0,32,32} {123,0,32,32} {124,0,32,32} {125,0,32,32} {126,0,32,32} {127,0,32,32} {128,0,32,32} .MATRIX 1 0 32 32 0.03605 0.02361 0.04013 0.04327 0.0691 0.06807 0.04878 0.09658 0.1163 0.1106 0.135 0.1309 0.1531 0.16 0.1757 0.1648 0.1673 0.1764 0.1665 0.1602 0.1511 0.1479 0.1171 0.1212 0.1008 0.1038 0.07122 0.06844 0.0582 .............

2 REPLIES 2

Philip. Oakley wrote:

Does anyone have any method for passing nested '3d' matrixes from MathCAD to Matlab?

I'm needing it for passing on to another bit of code.

For example a .prn file reader that, in matlab, will parse the MathCAD saved .prn file format?

Philip

A partial example (with missing line breaks 'cos the thread interface don't work..)

// Datafile written by Mathcad // 07/15/11 14:10:29 .MATRIX 0 0 128 1 {1,0,32,32} {2,0,32,32} {3,0,32,32} {4,0,32,32} {5,0,32,32} {6,0,32,32} {7,0,32,32} {8,0,32,32} {9,0,32,32} {10,0,32,32} {11,0,32,32} {12,0,32,32} {13,0,32,32} {14,0,32,32} {15,0,32,32} {16,0,32,32} {17,0,32,32} ....MATRIX 1 0 32 32 0.03605 0.02361 0.04013 0.04327 0.0691 0.06807 0.04878 0.09658 0.1163 0.1106 0.135 0.1309 0.1531 0.16 0.1757 0.1648 0.1673 0.1764 0.1665 0.1602 0.1511 0.1479 0.1171 0.1212 0.1008 0.1038 0.07122 0.06844 0.0582 .............

Do you specifically need Matlab to read a file, Philip, or will a component method do? If so, I think there may be something in my MDA library. I used Matlab to verify some of the MDA functions.

Stuart

Stuart,

My alter ego needed it for a colleague. We soirted out a way of programmatically converting the '3d' matrix to a long single vector which was then written (prn) and then read back to Matlab.

A component approach would have probably been acceptable. I've got a copy of your MDA library stashed away 'somewhere' (actually as a simple Utilities handbook...)

The other part of the trick is to manage to run the mathcad and matlab at separate times (aren't users fickle;-).

Thinking as I type, I suppose thay could also have saved the data into matlab.mat files (with the matlab -V4 option).

Ideally PTC/Mathsoft would have done MDA years ago, etc. but they chosen a prime green field site for a re-build...

I'll look at the MDA

Philip

Announcements

Top Tags