Shrediquette / PIVlab

Particle Image Velocimetry for Matlab, official repository
https://shrediquette.github.io/PIVlab/
MIT License
140 stars 34 forks source link

Export self-defined variable to workspace #76

Closed ruinianxu closed 2 years ago

ruinianxu commented 2 years ago

Hi,

Continuing from the previous issue, we've successfully separated in and out vectors and drew them in different colors. We found that we are allowed to export variables to workspace for easy analysis. We wonder how to do it for our self-defined variables e.g., 2D array in_vectors.

Sorry for keeping disturbing you since I do not have too many experiences with Matlab. Really appreciate it if you could provide us with some hints.

quynhneo commented 2 years ago

vector field drawing in matlab is done by quiver https://www.mathworks.com/help/matlab/ref/quiver.html

ruinianxu commented 2 years ago

@quynhneo Thank you for your reply. We've finished drawing vector field but stuck in exporting new added variables to workspace. Really appreciate if you could give us some hints about it.

Shrediquette commented 2 years ago

The easiest and dirtiest way is to use the function 'assignin'. That can send variables directly to the workspace.

ruinianxu commented 2 years ago

@Shrediquette Thank you so much for your quick reply. I have a brief idea and will go for a try now. Thanks!

ruinianxu commented 2 years ago

@Shrediquette It works! I manually export self-defined variables to workspace within the plot function. But the issue is only variables for one frame will be exported. Do you have any ideas about how to combine several frames' variables together and export it at once? Thank you so much for your help!!!

Shrediquette commented 2 years ago

Hi, search for assignin in the function pivfftmulti.m I think there is an example in this file how to do it.

Shrediquette commented 2 years ago

I didnt remember correctly...: in PIVlab_GUI.m, there is: assignin('base','correlation_matrices',correlation_matrices_list);

That saves the correlation matrices for each frame. You can check the code to find out how it works. Search for how correlation_matrices_list is generated.

ruinianxu commented 2 years ago

Thank you so much for you help!!! I will go for a check now.