Answers Support MathWorks. Search Support Clear Filters. Support Answers MathWorks. Search MathWorks. MathWorks Answers Support. Open Mobile Search. Trial software. You are now following this question You will see updates in your activity feed. You may receive emails, depending on your notification preferences. Show older comments. Kash Costello on 30 Jan Vote 0. Commented: Steven Lord on 31 Jan Hi guys! So, in IDL, it automatically identifies the data type of numbers.
Like for example, the number is considered long but when you type this in Matlab, and you put the command "class" or "whos", it's considered as double. Is there a way in Matlab to figure out the data type the way in IDL?
Thanks a lot! Answers 1. Steven Lord on 30 Jan Cancel Copy to Clipboard. There are some functions and functionality that by default create variables of different types. Notable among them are true and false which create logical arrays, the conversion functions int8 , uint16 , etc. If you want to know the type of a particular variable use class. If you want to know if a variable is a something, you can use isa which offers options to check if something is stored as a numeric class, a floating-point class, or an integer class.
If you are ever tasked with converting a script from one language to the other, they are differences that could have you so frustrated that you are screaming at the ceiling and banging at your desk with all your might. My personal preference for running either of these two applications is to do so in a command line setting where the machine isn't bogged down with memory intensive graphical user interface stuff.
In IDL, this is pretty easy to remember since there are two separate commands for the command line version and GUI version:. In Matlab, the default behavior is to start up the very memory hungry GUI.
When I'm running this remotely, it is agonizingly slow, so I usually choose to run it from the command line instead. The problem is that the latter requires using some arguments that are difficult to remember, so I always have to look them up if it's been awhile since I last used it. Let's start off with the obvious one. The one that you probably discovered within minutes of switching from one program to the other: indexing arrays.
And when we access the first element in the array, we must use the index of 0. We must also be careful to use N-1 as the final subscript, i. Let me tell you, folks, this one had me debugging code for almost an entire afternoon. In this case, I'm torn as to which language is doing things better. In most cases where a for loop is used, one doesn't pay explicit attention to the value of the counter after exiting the loop.
But if you happen to need that value of the counter for instance, after using a break statement , you'll find very different behavior in IDL and Matlab. You can see that after exiting the for loop, the counter is incremented one more time so that it has a final value of Choose a web site to get translated content where available and see local events and offers.
Based on your location, we recommend that you select:. Select the China site in Chinese or English for best site performance. Other MathWorks country sites are not optimized for visits from your location. Toggle Main Navigation. Search Answers Clear Filters. Answers Support MathWorks. Search Support Clear Filters. Support Answers MathWorks. Search MathWorks. MathWorks Answers Support. Open Mobile Search. Trial software.
0コメント