From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
11-14-2018 10:46 AM
I get it now. I still find it a shame the lack of certain functions in Labview.
11-14-2018 10:58 AM
11-14-2018 11:20 AM
If you are comparing LabVIEW to Matlab, a purely mathematical application, then yes LabVIEW will not live up to your expectations because LabVIEW was not written as a replacement for Matlab. There is integration between LabVIEW and Matlab if that is something you are interested in. However, the basic tools are available to you as the developer to make your own functions (subVIs), ones that Matlab may have available as standard but are not currently found in LabVIEW, such as taking a mean in the 3rd dimension. There are toolkits available on VIPM that others have developed to provide additional functionality and I would encourage you to go check that out.
11-14-2018 11:46 AM - edited 11-14-2018 11:54 AM
@RaphaelMT wrote:
I'm use in Matlab to avoid loops. I fear that the process will be extensively slowed down by them.
That's the silliest thing I heard in less than a week. Why would a FOR loop slow down anything? Do you really believe that Matlab can magically operate on thousands of values in parallel just because you don't see a loop??? 😮
For more discusssions, have a look at my recent post here. Still applies.
@RaphaelMT wrote:
That is the wrong direction. I don't want the mean of the row or column but of the depth. I want to go from a 1000x1000x3 matrix to a 1000x1000 one.
That's exactly what my code does! Have you even tried???
11-14-2018 12:45 PM
Ii most likely as to do on how Matlab interpret the code you've written. For exemple, for two arrays the same size you are trying to multply each element by each other you could write it in these two ways:
1. Everything at the same time
A.*B
2. Or row by row
for n = 1:length(A(1,:))
A(n,:).*B(n,:)
end
In the end it's the same computation and should be the same amount of parallelism but the first option takes half the time in Matlab.
11-14-2018 01:18 PM
@RaphaelMT wrote:In the end it's the same computation and should be the same amount of parallelism but the first option takes half the time in Matlab.
If that bothers you, post it in the Matlab forum. It has no relationship with LabVIEW and FOR loops there. Have you compared LabVIEW with Matlab? That's all that matters. Also be aware that benchmarking is more art than science and is difficult to get right in either environment.
11-14-2018 01:22 PM
I just wanted to explain you my hesitation toward loops in general. If it's different in labview, that's great. I'll do more testing to see how it performs.
11-14-2018 01:43 PM
I don't understand why you are trying to code a LabVIEW solution in Matlab if Matlab already has the functionality available "without using loops" as you say. This whole thread is not making any sense to me.
11-14-2018 01:43 PM
@RaphaelMT wrote:In the end it's the same computation and should be the same amount of parallelism but the first option takes half the time in Matlab.
And with a better compiler implementation, both code fragments could turn into identical binary code. Matlab decided not to do that and they probably have a good reason, such as the the ability to debug. These are very complex decisions. Most algorithms can be written in many ways in either environment and it is up to the programmer to decide if performance of a particular code fragment really is the bottleneck. Most of the time it isn't. It isn't worth spending days to shave off a nanosecond.