How can i edit my code which works on r2014b version at work but not on my personal r2024a version?

I have an IAD code, number of lines long. It works great on the MATLAB r2014b version but on my r2024a version at home, i get an error of the following:
Running IAD on dataset 1
zsh:1: command not found: iad
Sample1_IAD.txt
Error using movefile
No matching files named 'XXXXXX' were found.
Error in IAD_Analyzer_WCV_04_11_23 (line 239)
movefile(iad_output_file,strcat([pwd, '\results']))
Please can someone well versed in MATLAB suggest what I should change in the code to address this error in the r2024a version? It seems to be a matter of changing file location or using a different cmd from 'movefile' etc but I've tried all I know to do with no success. Thank you, I appreciate any help.

2 Comments

movefile(iad_output_file,strcat([pwd, '\results']))
You should be using fullfile() instead
movefile(iad_output_file,fullfile(pwd, 'results'))
Hi Walter, thank you. Unfortunately, this did not work. MATLAB gives the same error but this time with the fullfile()

Sign in to comment.

Answers (1)

No matching files named 'XXXXXX' were found.
This is the error. It should give you a clue.
Put a break point at line 239 where the movefile() is. Let it run and pause at line 239. Make sure both the source and destination exist.

17 Comments

Thank you Fangjun, I have inserted a breakpoint using the dbstop command. Please explain what you mean by ensure the source and destinaton exist? Usually, I create an empty results folder on my computer and the code should save the various Sample 1, 2, 3...# results into that folder (# = number of samples I'm processing at that time) . So i end up having .rxt and .txt files for each of my samples. However, it seems in the r2024a version, the code keeps getting hung up at line 239 after only creating sample1.rxt.
This is what I get after running the dbstop command:
Running IAD on dataset 1
zsh:1: command not found: iad
Sample1_IAD.txt
K>> IAD_Analyzer_WCV_04_11_23
At this moment, run the following to make sure both the source and destination exist. The return value should be non-zero.
exist(iad_output_file)
exist(fullfile(pwd, 'results'))
zsh:1: command not found: iad
I think that is your real problem. An executable named iad is needed in your current directory or on the system path.
Note that any PATH you might be setting in your .zshrc is going to be ignored by MATLAB: MATLAB is started from the dock rather than from a terminal session, so MATLAB does not go through zsh startup procedures.
Thank you both. Exist(iad_output_file) gives me 0, the latter gives me a non-zero number. I think this is the problem as Walter mentioned, I do have a .exe file in the folder but after checking it seems it is empty. After reading online, it seems mac systems are not equipped for running .exe files which may be the reason the current file in my folder is empty.
Mac do not run .exe (not unless you have Parallels or equivalent installed)
Yes, I will have to find alternate solution to run my codes when working at home. Thank you for all the help
Yes, that is the code. I found that page earlier which includes the github links. But I could not understand which link I should be downloading for use on my mac as it gave two options: one for Windows and another for a unix distribution (unsure what this one is)
You download the Unix distribution as a zip. Unzip it. Then open a command window to the appropriate directory, and give the (unix) command
make
Note: I am currently investigating the Makefile's use of ctangle -- at the moment make probably gets stuck
The Makefile invokes a program ctangle that you are unlikely to have installed on your Mac.
I found the binary at https://mmix.cs.hm.edu/osx/index.html . The link there is directly to the binary. Right-click and Save As.
Once you have the binary, you will need to
chmod +x ctangle
Then
PATH=$PATH:/directory/that/you/stored/ctangle make
Unfortunately this leads to the message
ctangle -bhp ad_main.w
! Input line too long. (l. 290)
fprintf(stdout, " 8) bbottomslide = optical depth of bottom slide (for absorbing slides)\n")
(ad_main.c)
(Pardon me, but I think I spotted something wrong.)
If you edit that line to be
fprintf(stdout, " 8) bbottomslide = opt. depth of bottom slide (for absorbing slides)\n")
then it will compile, eventually creating the iad executable.
Hi Walter, thanks so much. In following your directions, I have added the unix file to my computer. Opened it on my matlab and added to path. downloaded the ctangle.txt file and also added it to the unix folder which is in my current matlab directory. I then used the chmod +x ctangle. but i get the error:
Unrecognized function or variable 'chmod'.
Did you mean:
>> mod +x ctangle
Using mod also does not make a difference. I get an error.
Please let me know what I have missed. Thank you
Also entering the command make does not give any results. I entered it both into matlab and my mac terminal
The chmod and the make must be entered at the Terminal utility
yes thank you. but the make cmd keeps giving this message in terminal:
xcode-select: note: No developer tools were found, requesting install.
If developer tools are located at a non-default location on disk, use `sudo xcode-select --switch path/to/Xcode.app` to specify the Xcode that you wish to use for command line developer tools, and cancel the installation dialog.
See `man xcode-select` for more details.
Visit https://developer.apple.com/xcode/resources/ and select "View downloads" under "Additional tools". That will prompt you to log in to Developer program. You might need to create a new account (it just uses AppleID but you have to specifically sign up for it.) Accounts are free.
Once signed in, you will be at
Search for "Command Line Tools for Xcode 16 beta 4" or similar, adjusting for your XCode version. Download and install the .dmg that results.
After that, you will need to start XCode once, and agree to the license. You can quit XCode after that -- you just need it for the purpose of agreeing to the license.

Sign in to comment.

Categories

Asked:

on 19 Jul 2024

Commented:

on 3 Aug 2024

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!