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

Community Tip - Visit the PTCooler (the community lounge) to get to know your fellow community members and check out some of Dale's Friday Humor posts! X

Combining three matrices into one

zjv
5-Regular Member
5-Regular Member

Combining three matrices into one

Dear friends, I need a bit of help. I have a set of values "PFscan.csv". It contains 70 columns x 1800 rows. This values represent z, and should be connected with r and t data, acting as a x and y. To create a x,y,z set with same dimensions I've made a matrices M1 and M2 from r and t, both containing 70 columns x 1800 rows. The goal is to combine this three sets into one matrix, which will consecutively contain (x,y,z)i. Hence matrix M3. So the questions are: How can I export this as .csv or .txt while being able to maintain order; x1,y1,z1, x2,y2,z2, etc.? How can I plot multiple datasets into one 3D graph by using for loop? And to convert this large x,y,z set to polar plot? Thanks!
ACCEPTED SOLUTION

Accepted Solutions
DJF
16-Pearl
16-Pearl
(To:zjv)

I may not be completely sure what you are after, but I think the attached example (5.0) does something close.  

View solution in original post

8 REPLIES 8
DJF
16-Pearl
16-Pearl
(To:zjv)

I may not be completely sure what you are after, but I think the attached example (5.0) does something close.  

Werner_E
25-Diamond I
(To:zjv)

Its unclear to me what kind of matrices you'd like to create but maybe the attached Prime5 file can help with plotting the data

B.jpg

zjv
5-Regular Member
5-Regular Member
(To:Werner_E)

Dear Werner, Can you integrate your approach into a new file I've submitted? I used DJF routine to create data-file that can be exported to other software. However, I really like your approach since it enables fast visualization of data within Prime5. I tried to do this myself, but your undocumented trick (not anymore :)) stopped working for some reason Thanks, zjv
Werner_E
25-Diamond I
(To:zjv)

Not sure which problem you ran into - I don't see any error or that you copied any necessary regions into your sheet .

You don't need to use the undocumented trick I mentioned to create the necessary vectors. You already did it using normal program routines.

So simply replace my "vec_r" for your "rad" and you may create "vec_t"  using your  "theta" by simply writing "vec_t:= theta*deg" as the values you provide obviously are in degree and not radians.

BTW, you may created the necessary vectors more streamlined as shown below

B.jpg

 

P.S.: IN case you didn't notice it - the trick mentioned was to define a range and immediately follow it by an evaluation (= sign). This turns the range into a vector of values. If you don't use the = sign it won't work.

The standard way to create a vector is like shown above.

zjv
5-Regular Member
5-Regular Member
(To:Werner_E)

Hi Werner, I don't know why but I still had problems with integrating your part with my document. For some reason, the part shown in image below was not possible to calculate (rows(vec_r) and rows(vec_t) was reporting an error ???). However, when used in your document alone, everything worked correctly. Thus, I decided to split file - one for exporting data (merging parts from DJF) and other for plotting (your approach). Thanks!
Werner_E
25-Diamond I
(To:zjv)

Hard to say why it failed without seeing the file with the error.

 

BTW, your description does not correspond to the data structure you create:

B.jpg

zjv
5-Regular Member
5-Regular Member
(To:Werner_E)

Werner, thanks for the comment, I haven't noticed an error before. Now it is corrected. The file is attached. I still have a problem with vec_r and vec_t error like as shown in attached image.

 

Thanks.img.JPG

Werner_E
25-Diamond I
(To:zjv)

The problem is that you defined variables "rows" and "cols" and therefore the built in identically named functions are not available anymore.

B.jpg

Solution: Use different names for your variables. As variable names are case sensitive you may even call them "Rows" and "Cols" if you like.

Announcements

Top Tags