FEMM bitmap file saved via Matlab script is damaged.
24 ビュー (過去 30 日間)
古いコメントを表示
Hello!
I would like to save the resulting picture of a FEMM simulation through a Matlab script. The corresponding part of my script is the following:
a='probastring%d.png';
filename=sprintf(a,alpha);
mo_showdensityplot(1,0,2.5,0,'mag');
mo_savebitmap(filename);
This runs in a cycle, because I need pictures of a series of calculations.
The issue is that the file created like this is damaged. I tested the command in the inbuilt lua console, and it works just fine, and obviously changing the fileformat doesn't help. I also put some commands after this part so that the FEMM window doesn't close too soon, but it didn't help either. The funny part is, that my college ran this for me, and on his computer it worked perfectly.
Does anyone have an idea how to solve this issue without reinstalling everything? What could cause such an issue?
Thank you very much:
Bence
5 件のコメント
回答 (1 件)
Shubham
2024 年 8 月 28 日
編集済み: Shubham
2024 年 8 月 28 日
Hi Bence,
When dealing with issues like this, especially when a script works on one machine but not another, there are several troubleshooting steps you can follow to identify and potentially solve the problem:
- Ensure that the directory where you're trying to save the images has the appropriate write permissions. If the script doesn't have permission to write to the directory, it could result in corrupted files.
- Make sure the file path is correct and that the directory exists. You might want to print the filename variable to confirm it's being set as expected.
- Ensure that both environments (yours and your colleague's) have the same Matlab version and configurations. Differences in Matlab settings or installed toolboxes might affect how scripts run.
- Check if both computers are using the same version of FEMM. Different versions might have different behaviors or bugs.
- If the script is running too fast, the image might not have time to render before being saved. You can try adding a pause before the mo_savebitmap command to ensure the plot is fully rendered. For example:
pause(1); % Pause for 1 second
mo_savebitmap(filename);
6. Sometimes temporary files might be causing issues. Try clearing temporary files or restarting Matlab to see if that helps.
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Startup and Shutdown についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!