05-15-2015 10:30 AM
I am using LabVIEW 2013 and am trying to incorporate some Matlab code a colleague wrote. I kept running into a problem in one section, and have been able to reproduce the issue.
I am using Cell data to store an array of valid, variable length strings. When I try to pick one of the strings, and compare it to another string, the Mathscript node gives me an error (see below):
Whereas the following code works just fine:
Is this expected behavior because of using cell data? Is there a way to work around this?
Thanks for your help.
05-16-2015 05:01 PM
Hi
Try to change brackets like on example below
Regards
05-17-2015 06:35 AM
I strongly recommend doing everything in LabVIEW (string arrays are easy) or everything in MatLab. Mixing the two languages gives you opportunities for errors in both. You are missing the commas between the array elements in your first line of Matlab code.
BS
05-17-2015 12:30 PM
Adding to Bob's post, that's an incredibly easy piece of code to translate into LabVIEW. I trust your colleague's matlab code is a bit more advanced. But, you'll find there's some overhead related to adding an extra compilation task there. If performance is at all a concern for you, you'll want to convert the code into LabVIEW and then move forward. If that's not an option, you should consider the option of developing their code instead. If you can't develop matlab, their code will be something you can't modify going forward. Why would you want to add a block to your code that you can't modify?
05-18-2015 10:43 AM
Thank you all for the solution and advice.
The posted code was an example that attempted to reproduce the error I was seeing (and fortunately it worked). Interestingly, the code works without the commas in Matlab. The actual code is hundreds of lines long, and I've worked through some other errors, but had no idea on this one.
I would much rather convert the code, but I don't get to make the decision in this case.