Matlab - import data tool - matlab

i have got a problem with the import data tool in matlab.
I just installed matlab this morning, at first it worked. However after shutting down the computer once, it doesn't work anymore.
More specifically, it opens and load data from .txt or spreadsheet, but when i click to import data to my workspace, instead of showing the progress in the waitbar it shows an error message:
IMPORT TOOL - couldn't find waitbar handles
any suggestion?

Sounds like the import tool works as intended until it cannot find the wait bar. A waitbar is a loading progress bar, which is available every basic installation of MATLAB (no toolbox required). Either the waitbar is created (do you see it?), but somehow not passed correctly through a broken connection between the import tool and the waitbar, or the waitbar function wasn't installed correctly.
I conclude your installation wasn't finished properly, so: uninstall MATLAB and reinstall it in one go (without pausing the installation).
You could also provide the system details you're installing on and the MATLAB version. Maybe someone knows of a certain condition of your particular setup that might cause the problem.

Related

How do I get transformers' .from_pretrained("model") to consistently show download progress in a Jupyter Notebook?

I'm running a Jupyter Lab instance on a remote server which I access through my browser
I'm working with a notebook from a venv kernel that imports the AutoTokenizer and AutoModelForCausalLM classes from transformers, then downloads the elements for each from a model we'll call "model", using each class' .from_pretrained method.
the actual importing and downloading works fine; however, the first time I ran the cells containing AutoTokenizer.from_pretrained("model") and AutoModelForCausalLM.from_pretrained("model"), a text-based download progress bar appeared in the output text. this went through each file download until the kernel crashed (for reasons that I am yet to troubleshoot, but I suspect are related to storage allocations).
when I ran the code again, everything worked the same, but the progress bars never reappeared. the same thing happened a few weeks ago when I tried this the first time with a different model and slightly different environment
What I've tried:
I've tried creating a new kernel from a new venv. I've tried restarting jupyter. neither made a difference
there was a warning that appeared underneath the transformers import that suggested I should install ipywidgets. this was there the first time when the progress bar did appear, and again when it didn't, but somewhere online suggested that ipywidgets and progress bars could be linked, so I imported it to the venv anyway. this unsurprisingly did not help
I've tested whether I get output at all: I do. if I enter 1+1, "2" outputs. I also still got the ipywidgets a warning a few times before I installed it
I made sure that the output is not just being collapsed. View -> Menu -> Collapse/Expand all Outputs does not make anything new appear, besides some ellipses.
I tried doing pip install --upgrade jupyter_client, but it basically said there's nothing further to upgrade.
I tried a browser based on a different engine (chromium instead of ff). I tried with my adblocker on and off
if I download a different model, that does seem to work, once, but then as soon as the kernel crashes a single time trying to download that model, it will never show them again, even when it's clearly actually downloading them

MATLAB runs prior iterations of file

Summary: MATLAB runs an earlier version of my code, despite having saved the new version.
When I run my code, MATLAB seems to run an older version of it. For example, I changed the print statement from "What is the name of the vector you wish to analyze?" to "Hello. How are you?", but it still runs the previous version of the code, despite the fact that I saved the file.
I have tried deleting all the files in the MATLAB "Current Folders" directory, and even opening new files for every small iteration of my code, but to no avail. I've tried searching for resolution to similar errors online, but this does not seem to have been documented previously. The only resource that even refers to this online seems to be this question, whose only resolution was that "The error message was misleading."
I would greatly appreciate any help. I am new to MATLAB, so please pardon any naive mistakes.
In all likelihood, there are two copies of the code, the one you are editing and the one you are running.
If the code you are trying to run is called "mycode", try typing which mycode. This will tell you the location of the code version that you are running. I would also recommend closing the editor window and typing edit mycode, which will open that version.
Note: From the screenshot, it appears that you are running MATLAB through a web browser and I don't know how that handles files.

How to link MATLAB to Webots lib?

I created a MATLAB script for controller through wizards and uncommented
desktop; keyboard;
to interact with the MATLAB interface. Works are done on Win10.
My code works, but I have to start the MATLAB program from Webots to grant MATLAB access to Webots library. I tried opening MATLAB alone and had no clue about linking the program to Webots lib and project.
Another drawback is that every time I modify the codes and reset the simulation in Webots, MATLAB is restarted, which is annoying since it takes quite a time.
Q: Is there any way to link MATLAB to Webots lib so that I can develop the controller in MATLAB alone without starting Webots?
Maybe below solve your problem.
Solution
In the launcher.m file (..\Webots\lib\controller\matlab):
Change each line containing 'lib/matlab' to 'lib/controller/matlab'
Lines are 15, 23, 132
and
In allincludes.h (..\Webots\lib\controller\matlab):
Change each include path so that it goes back a further directory
eg: #include "../../../include/controller/c/webots/accelerometer.h"

Matlab openGL Warning

I'm tasked with upgrading a lot of legacy models and scripts made in an older version of Matlab/Simulink and have it running smoothly in R2018b. Among other requirements I'm not allowed to have any warnings issued upon execution of .m scripts or Simulink models. This is generally tedious but straightforward to comply.
However, there is a specific warning that Matlab does not give me hints on possible sources:
Warning: MATLAB has disabled some advanced graphics rendering features by switching to software OpenGL. For more information click here.
The link opens the Matlab Help page titled Resolving Low-Level Graphics Issues, which describes issues I'm not finding (or at least not noticing)
I do note that many scripts I run create and close figures, but this is done procedurally. I haven't been able to associate this warning with some specific function or feature. I'm working on a Windows Server machine.
Does anyone have an idea of how to narrow down which kind of function os Simulink block could cause this warning?
As datenwolf and Ander point out, the first thing to try is to update your drivers. If this doesn't work, and your only problem is that you're getting the warning but your graphics still render fine, then you have two other options to try.
First, you can simply modify your OpenGL rendering preferences using opengl. The following will set your preference to 'software' and save that setting for future sessions:
opengl('save', 'software');
Alternatively, you can just try to suppress that particular warning message. After you get the warning, issue this call to the warning function:
w = warning('query', 'last');
The w.identifier field will give you the ID for the warning message, which I believe will be 'MATLAB:hg:AutoSoftwareOpenGL' in this case. You can then add the following line to your startup.m file so that this warning is suppressed every time MATLAB is opened:
warning('off', 'MATLAB:hg:AutoSoftwareOpenGL');
Install the original vendor drivers for your GPU. The drivers that are installed by Windows by default lack full OpenGL support. Download the driver package directly from the website of Intel, AMD or NVidia, depending on what GPU you have.
If you don't have GPU, for example when running in a Virtual Machine, then you can not avoid that warning, because then Matlab has no other choice than falling back on the software OpenGL implementation that it ships with.
There's nothing you can do about that, other than making sure, that the system you're running Matlab on, does have proper OpenGL support!
It took me a long time to get it, so I'll put you here in case it helps how I managed to activate openGL in Linux:
If you haven't already (it's common for other problems), rename libstdc++ library from MATLAB:
mv _YOUR_MATLAB_ROOT_FOLDER_/sys/os/glnxa64/libstdc++.so.6 _YOUR_MATLAB_ROOT_FOLDER_/sys/os/glnxa64/libstdc++.so.6.bak
Create this link: sudo ln -s /usr/lib/x86_64-linux-gnu/dri/ /usr/lib/
Run export MESA_LOADER_DRIVER_OVERRIDE=YOUR_DRI_DRIVER;matlab -desktop -nosoftwareopeng
Your DRI Driver will be a file from /usr/lib/dri, removing "_dri" (in my case was the "radeons" driver for an AMD Vega graphic card.
Run MATLAB from a terminal using: export MESA_LOADER_DRIVER_OVERRIDE=_YOUR_DRIVER_HERE_;matlab -desktop -nosoftwareopengl. YOUR_DRIVER_HERE should be your driver, radeonsi in my case.
Check openGL with info = rendererinfo
If something went wrong, you will be able to see in the terminal which library was responsible. Executing 4) and 5) I was discovering what I had to correct, you can do the same if you have another problem that has not appeared to me.
So that it always runs correctly I put export MESA_LOADER_DRIVER_OVERRIDE=YOUR_DRI_DRIVER at the beginning of the script that runs matlab (_YOUR_MATLAB_FOLDER/bin/matlab), although I suppose it can also be set as an environment variable.
I hope this has been useful to you.

How to change Matlab settings (for history.m) in terminal?

I am using Matlab on a remote server from my MacBook. Partly because I find the Matlab GUI clunky under X11, I use it in the terminal window (by running matlab -nodesktop). This has been working fine, until I now needed to copy some stuff from the command history.
It seems like history.m is only being saved on exit, even though when I check the settings in the GUI, it says that it is being saved for each command. It also seems like exit statements are included in history.m when Matlab is run from terminal, but not in the GUI, so it seems like the settings in the GUI don't apply there. I cannot find anything in the Matlab help pages on how to change the settings for the terminal window.
I need to access the command history for my session while it is still open. Does anybody have an idea about how I can do this -- short of starting to use the GUI?
You might try the diary function. It logs both commands and their (text based) results to a file. On my system (Mac OSX with MATLAB R2011b), the output does not show up in the diary file immediately, but it does update when you turn off the diary. Which you can do repeatedly if you need without exiting matlab.