Jump to content

Manoj Kandukuri

  • Content Count

  • Joined

  • Last visited

  • Days Won


Everything posted by Manoj Kandukuri

  1. Hi Debdatta, the if statement "dataTypeName==search" compares number of characters in both variables. That's the reason why the error raised. Instead use "strcmpi" which compares the characters itself in variables if strcmpi(dataTypeName,search) == 1 % 1 == logical yes if both variables are identical printf('Stress result found!') end thanks, Manoj
  2. There are multiple commands to extract CAE/Test data file in Compose OML. of which, readmultvectors, readcae commands extracts results of specific input arguments given by the user. I had multiple requests from users asking, as these 2 functions serve the same purpose then whats the difference between readmultvector & readcae? Which one do we use and when? As an engineer myself, I tried to break it down based on 2 key factors below: 1. Syntax differences (Ease of Use) 2. Speed/Performance Attached is the paper i wrote about the same with example. Hope this helps users to pick the right command for their tasks. Happy coding!! Thanks, Manoj kandukuri readmultvector_readcae_why_are_they_2.pdf
  3. Hi Debdatta, You can use "real" & "angle" commands to get magnitude and phase of fft signal real(ft) angle(ft) thanks, Manoj kandukuri
  4. Hi Batuhancoskun, As your variable 'str' is a string, you can get desired output by using indexing to get the "letters" form the string --> str(6:end) output: ForGeeks if you want to split a string at a desired character/delimiter you can use 'strplit', 'regexp' functions. Hope this helps
  5. Below is kind of a hack in 2019.2 1. set python as preferred language under file>preferences>Compose>General 2. open new python and OML files (to trigger OML command window) 3. close compose and relaunch you will see both OML and python interpreters.
  6. Hi Nils, you can use "set(gca,'xtick',7)" where 7 is number of ticks you want to have between the limits [0:t_sim]. hope this helps thanks, Manoj kandukuri
  7. Do you see 'fid' variable has a negative value ? if so, you might not have the 'nodes.txt' in the current working directory. can you please make sure you have the file in current working directory, if not change the working directory or have the fullpath to the file. like: fid =fopen('C:/temp/test.txt', 'r') thanks, Manoj kandukuri
  8. Hi Dung, you can get more accurate result by having a tolerance condition inside a while loop. something like below: %% clc, clear sum = 0; sum_before = realmax; tol = 1e-12; % tolerance value i = 0; while (abs(sum_before - sum) >= tol) i= i+ 1; sum_before = sum; sum = sum + 1/(i^2); end %% Hope this helps Thanks, Manoj kandukuri
  9. Please add the below lines on top in your zzz.py and it will do the trick. sys.path.append sets the path to import the files from the current folder. import sys sys.path.append('C:/Users/vkandukuri/Downloads') #change the path to the path where you have the files Thanks, Manoj kandukuri
  10. Hi Berker, As Python doesn't uses the plotting framework of OML, you can undock/dock the figure in python by using run_line_magic ipython api's set the positions and sizes. add below lines in your script to create pop up figure window from Python from IPython import get_ipython get_ipython().run_line_magic('matplotlib', 'qt') And to size the figure window you can use "matplotlib.rcParams['figure.figsize'] = (h, b)" where h and b are widow size. Note: get_ipython().run_line_magic('matplotlib', 'qt') undocks the figure window and get_ipython().run_line_magic('matplotlib', 'inline') docks the figure in command window. I have edited your python script as attached. hope this helps. If you want to have the plots inside OML only, then you can transfer the data from python back to Compose OML (by using getpythonvar command) and then plot inside OML. Did you try transferring of data back to OML from python and then do plotting inside OML? Thanks, Manoj kandukuri plot_test2_2.py
  11. Roberta, i just tried your suggestion, it didnt work. compose interpreted it as a string... Manoj kandukuri
  12. Hi Seoksan, you can save the plot to a variable and then set linewidth property for this variable.. clf; x = linspace(0,10,150); y = cos(5*x); h = plot(x,y,'b--o','linewidth',0.1); title('2-D Line Plot'); xlabel('x'); ylabel('cos(5x)') set(h, 'linewidth', 4) Manoj Kandukuri
  13. Thanks for your reply Jeff. I wanted to profile the functions used in oml scripts and their execution times in a report to improve the performance of the code. MK
  14. Is there a way to get list of functions (both inbuilt and user defined) used in .oml scripts? Thanks, MK
  15. Seoksan, I'm not sure why it didn't work but when i searched online, i found this is due to possible bug in axis('equal') - equal scaling by changing the limits when clf is refreshed, this causing the ylim changes to fade out. ( see https://github.com/matplotlib/matplotlib/issues/8093) Thanks, Manoj kandukuri
  16. Hi Seoksan, In the python file you have axis set to 'equal' and that is trying to make the axis limits to be equal. comment the line "plt.axis('equal')" and you can set the ylim and xlim as you requested. #plt.axis('equal') # axis limts plt.ylim(-4,2) plt.xlim(-1,5) Hope this helps MK
  17. Hi SeokSan, Meshgrid of x and y vectors would give you the rows of the output array X which are copies of the vector x; columns of the output array Y are copies of the vector y. in your 1st example: X values are replicates of vector x and Y values are replicates of vector y' (transpose of vector y), giving you X & Y as square matrices with data points representing in 2Dplane (something like Cartesian coordinates) So when you calculate z (in your 1st example) you're doing element-wise multiplication of sin(X) (which is x vector repeated Horizontally) and cos(Y) (which is y vector repeated vertically) in your 2nd example approach, while calculating c you're doing matrix multiplication of sin(a') (which is x vector repeated vertically) and cos(b) (which is y vector repeated Horizontally) which is not the same mathematical operation as your 1st approach. that is why you see 2 different graph's. so to achieve the same result with these 2 approaches; you need to surface plot of c' (transpose of matrix c) surf(a,b,c') or change the logic little bit a=[0:0.1:2*pi]; b=a'; c=cos(b)*sin(a); figure(2) surf(a,b,c) Hope this helps!
  18. Hi Ronald, I apologize for late reply.. I don't have an existing macro which does the same... Thanks, MK
  19. How to display a portion of a string as BOLD (for example : label ON) in uicontrol? han.text_label = uicontrol('Style', 'edit','string',{'label : on'},'FontSize',10,'fontweight','bold', 'Position', [1 100 200 30]); Thanks, Manoj Kandukuri
  20. Hi SeokSan, As stmaster suggested you can do undock/dock manually. And if you want to make the Float option as default, You can select/check the Float option in Preferences file. File> Preferences > plot> Float Thanks, MK
  21. Hi Ronald, You can use max or min command to find the maximum or minimum Y value in the data. Hope this helps, Thanks, Manoj Kandukuri
  22. Hi BeLlng, Bar3 is supported in next release (in next 2 months). With Compose as an IDE ,we can leverage Python bridge to achieve the task of plotting the 3D bar, (as it is not yet supported). I have created a simple example( as attached) for doing so. I'm not sure if you have prior experience with python, but I have attached python bar3 help document as well for your reference. https://matplotlib.org/2.0.2/mpl_toolkits/mplot3d/api.html. If you have any questions regarding python bar3 example file or if you have any specific requirements let me know, i'm more than happy to help you.. Steps: 1. download the files in a folder 2. open test.oml and Hit Run (you will see bar3 plot in python console.) if you want to try it with your data, just replace foodat with your variable in line 5. ('exporttopython(foodat,'data');') test.oml bar3_py.py
  23. Hi Debdatta, you can use "System" or "Unix" command in OML which executes Shell command string.... I haven't used Linux for a while now, you can use shell commands like "Top", "/proc/cpuinfo", to get CPU utilization. I didn't tried these commands in Linux now as i don't have Linux machine: you can give it a try system('top -b -n 1 |grep ^Cpu') system('/proc/cpuinfo') You can find many other useful linux shell commands online which can be used along with "system" or "unix" commands of COMPOSE OML. Hope this helps. Thanks, Manoj Kandukuri
  24. Yes Seoksan, Currently development team are working on it as we speak. Manoj kandukuri
  • Create New...