How can i edit my code which works on r2014b version at work but not on my personal r2024a version?
73 次查看(过去 30 天)
显示 更早的评论
Oluwadamilola Oke
2024-7-19
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 个评论
Walter Roberson
2024-7-19
movefile(iad_output_file,strcat([pwd, '\results']))
You should be using fullfile() instead
movefile(iad_output_file,fullfile(pwd, 'results'))
Oluwadamilola Oke
2024-7-22
Hi Walter, thank you. Unfortunately, this did not work. MATLAB gives the same error but this time with the fullfile()
回答(1 个)
Fangjun Jiang
2024-7-19
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 个评论
Oluwadamilola Oke
2024-7-22
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
Fangjun Jiang
2024-7-22
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'))
Walter Roberson
2024-7-22
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.
Oluwadamilola Oke
2024-7-22
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.
Walter Roberson
2024-7-22
Mac do not run .exe (not unless you have Parallels or equivalent installed)
Oluwadamilola Oke
2024-7-24
Yes, I will have to find alternate solution to run my codes when working at home. Thank you for all the help
Oluwadamilola Oke
2024-7-24
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)
Walter Roberson
2024-7-24
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
Walter Roberson
2024-7-24
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.
Oluwadamilola Oke
2024-7-25
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
Oluwadamilola Oke
2024-7-25
Also entering the command make does not give any results. I entered it both into matlab and my mac terminal
Oluwadamilola Oke
2024-7-25
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.
Walter Roberson
2024-7-25
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.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Introduction to Installation and Licensing 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!发生错误
由于页面发生更改,无法完成操作。请重新加载页面以查看其更新后的状态。
您也可以从以下列表中选择网站:
如何获得最佳网站性能
选择中国网站(中文或英文)以获得最佳网站性能。其他 MathWorks 国家/地区网站并未针对您所在位置的访问进行优化。
美洲
- América Latina (Español)
- Canada (English)
- United States (English)
欧洲
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
亚太
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)