How to use cam with matlab under Ubuntu16.04 - matlab

My os is Ubuntu16.04, and Matlab vision is 2015b, I installed OS Generic Video Interface and USB Webcams,and I got this after run imaqhwinfo:
InstalledAdaptors: {'dcam' 'gentl' 'gige' 'linuxvideo'}
MATLABVersion: '8.6 (R2015b)'
ToolboxName: 'Image Acquisition Toolbox'
ToolboxVersion: '4.10 (R2015b)'
but while I run obj = videoinput('linuxvideo',1);preview(obj);I got this:
Error using videoinput (line 233) There are no devices installed for the specified ADAPTORNAME. See IMAQHWINFO.
and I also cannot run webcam:
No webcams have been detected. Please ensure the webcam is connected to the system.
how to solve this ? thanks for your help!

Related

Raspberry Pi CM4 UBoot NVME-access

Does anyone have a working UBoot config for accessing an NVME drive from UBoot running on a Raspberry Pi CM4?
I've compiled everything and UBoot is detecting my NVME correctly:
pci_bind_bus_devices: bus 1/pci_0:0.0: found device 0, function 0: find ret=-19
pci_find_and_bind_driver: Searching for driver: vendor=2646, device=2263
pci_find_and_bind_driver: Match found: nvme
pci_auto_config_devices: start
pci_auto_config_devices: device nvme#0
PCI Autoconfig: BAR 0, Mem, size=0x4000, address=0xc0000000 bus_lower=0xc0004000
pci_auto_config_devices: done
but it doesnt call nvme_uclass_post_probe() and therefore it doesnt create any block device.
Running the command "nvme scan" from the UBoot command line i'am getting a timeout in nvme_submit_sync_cmd(). -> ETIMEDOUT.
I'am using a Kingston A2000 SDD with the latest firmware "S5Z42109".
Does anyone have an idea?
Thanks.

bladeRF simulink no device available error

I am connecting the bladeRF x115 to simulink with Matlab 2016a on a windows 10 PC.
I have followed the getting started guide on github:
www.nuand.com/bladeRF-doc/guides/bladeRF_windows_installer
Then I made a simple code as in the picture shown below:
I can simulate it only one time because when I tried to simulate it again I got the following error:
MATLAB System block 'testlinking/MATLAB System' error occurred when invoking 'setupImpl' method of 'bladeRF_Simulink'. The error was thrown from '
'C:\Program Files\bladeRF\matlab\bladeRF.m' at line 116
'C:\Program Files\bladeRF\matlab\bladeRF.m' at line 398
'C:\Program Files\bladeRF\matlab\bladeRF_Simulink.m' at line 364'.
Caused by:
libbladeRF error (-7) in bladeRF_open(): No devices available
Component:Simulink | Category:Block error
The reason for this error is because the led 2 is still blinking(device is in use). But it continues blinking even though I have closed matlab and simulink, and I don't know why?
Have a look at:
https://www.mathworks.com/matlabcentral/fileexchange/74591-communications-toolbox-support-package-for-bladerf-2-0?s_tid=mwa_osa_a
„Communications Toolbox Support Package for BladeRF 2.0“
Download the zip-file and navigate matlab to the directory bladerf.
This worked for me. The simulink block releases the bladerf-board so the Simulinkmodel can be stopped and restarted without problems/errors.
Your device is available with bladeRF cli?
Check:
bladeRF> info
Board: Nuand bladeRF 2.0 (bladerf2)
Serial #: 20f99xxxx
VCTCXO DAC calibration: 0x1de9
FPGA size: 301 KLE
FPGA loaded: yes
Flash size: 128 Mbit
USB bus: 2
USB address: 3
USB speed: SuperSpeed
Backend: libusb
Instance: 0
If is available close the bladerf cli and MATLAB. Open only MATLAB and check again.

Matlab not Working in Ubuntu (LibGL Error)

I downloaded MATLAB from my college's WLAN and installed it on my Ubuntu 16.04 system. But when I run the command matlab in the terminal, I get the following error.
libGL error: pci id for fd 4: ffff:ffff, driver (null)
libGL error: No driver found
libGL error: failed to load driver: (null)
libGL error: pci id for fd 4: ffff:ffff, driver (null)
License checkout failed.
License Manager Error -15
MATLAB is unable to connect to the license server.
Check that the license manager has been started, and that the MATLAB client machine can communicate with the license server.
Diagnostic Information:
Feature: MATLAB
License path:/home/darshan/.matlab/R2015a_licenses:/usr/local/MATLAB/R2015a/licenses/license.dat:/usr/local/MATLAB/R2015a/licenses/network.lic
Licensing error: -15,570. System Error: 115
I tried the solution given in MATLAB not working on Ubuntu 16.04 but it did not work. How do I fix this error?
I figured out the mistake I had done during installation of Matlab. I had downloaded some file instead of the network.lic file from my college network. Replacing it with the correct network.lic file solved the problem.

Error in sending data from arduino to matlab

I want to run simple example in arduino and send data from arduino to matlab for drawing plot,
my arduino code is following:
#include <SoftwareSerial.h>
int i=0;
void setup()
{
Serial.begin(9600);
}
void loop()
{
Serial.println(i);
i++;
}
and my matlab code is following:
arduino=serial('COM4','BaudRate',9600);
fopen(arduino)
x=linspace(1,100);
for i=1:length(x)
y(i)=instrfind(arduino);
y(i)=fscanf(arduino,'%d');
end
fclose(arduino);
disp('making plot..')
plot(x,y);
But I've faced with error! The following is matlab error:
Error using serial/fopen (line 72)
Open failed: Port: COM4 is not available. No ports
are available.
Use INSTRFIND to determine if other instrument
objects are connected to the requested device.
Error in kh (line 2)
fopen(Arduino)
and here is arduino error:
avrdude: ser_open(): can't open device "\\.\COM4": Access is denied.
My arduino uno (COM4) driver in device manager are installed.
I use matlab 2013a and َArduino 1.8.1 Genuino
How can I fix this error?
If you are using RS-232 for Arduino IDE/Monitor to communicate with your Arduino on COM4.
Since RS-232 is a point to point methodology, you can only have one program/device on each end unless you add a bunch of hijinks.
When you have the Arduino IDE/Monitor open it uses the com port and other programs are denied access.
I think you need to close the Arduino monitor program to release Com port 4 and then the Matlab program should be able to open the port.
PS : Test this using a terminal. Obviously the port needs to be open for the terminal to receive the arduino's prints. The terminal DOES open when you have the arduino ide open, but it DOES NOT open when the arduino's COM terminal is open. So theoretically, MATLAB shouldn't be having a problem when just the IDE is open.
This is how I solved the problem.
In device manager you will find the Arduino COM port.
Go to the Advance properties of the port
Set the COM port number to COM4
Then replug the USB.

Psychophysics Toolbox Matlab on Ubuntu Installation

I am trying to run code in Matlab that uses the Psychtoolbox and OpenGL. The commands that throw the error described below are:
PsychJavaTrouble
AssertOpenGL
Here are my specs:
OS: Ubuntu 14.04 LTS, 64bit
Processor: Intel Core i5-2450M CPT # 2.50GHz x 4
Graphics: Intel Sandybridge Mobile
Matlab Version: Matlab 64-Bit (Version 3.0.11 - Build date: Apr 6 2014)
Psychophysics version installed: 3
Installation methodology:
1. sudo apt-get install psychtoolbox in Terminal
2. updated it via UpdatePsychToolbox command in Matlab console
Here is the error message:
PsychJavaTrouble: Will now try to add the PsychJava folder to Matlabs dynamic
classpath...
Warning: "/home/lillian/Desktop/Matlab/Mona_Lisa/Psychtoolbox/PsychJava" is already
specified on static java path.
> In javaclasspath>local_validate_dynamic_path at 285
In javaclasspath>local_javapath at 182
In javaclasspath at 119
In javaaddpath at 71
In PsychJavaTrouble at 86
In ReverseCorrelationFaces at 2
PsychJavaTrouble: Added PsychJava folder to dynamic class path. Psychtoolbox Java
commands should work now!
PTB-INFO: Display ':0' : X-Screen 0 : Assigning primary output as 0 with RandR-CRTC
0 and GPU-CRTC 0.
PTB-INFO: This is Psychtoolbox-3 for GNU/Linux X11, under Matlab 64-Bit (Version
3.0.11 - Build date: Apr 6 2014).
PTB-INFO: No low-level controllable GPU on screenId 0. Beamposition timestamping and
other special functions disabled.
PTB-INFO: Failed to enable realtime-scheduling [Operation not permitted]!
PTB-DEBUG:PsychOSGetSwapCompletionTimestamp: Invalid return values ust = 0, msc = 0
from call with success return code (sbc = 304)! Failing with rc = -2.
PTB-DEBUG:PsychOSGetSwapCompletionTimestamp: This likely means a driver bug or
malfunction, or that timestamping support has been disabled by the user in the
driver!
PTB-INFO: OpenGL-Renderer is Intel Open Source Technology Center :: Mesa DRI
Intel(R) Sandybridge Mobile :: 3.0 Mesa 10.1.3
PTB-INFO: VBL startline = 768 , VBL Endline = -1
PTB-INFO: Will try to use OS-Builtin OpenML sync control support for accurate Flip
timestamping.
PTB-INFO: Measured monitor refresh interval from VBLsync = 16.685075 ms [59.933804
Hz]. (297 valid samples taken, stddev=0.310528 ms.)
PTB-INFO: Reported monitor refresh interval from operating system = 16.646968 ms
[60.070999 Hz].
PTB-INFO: Small deviations between reported values are normal and no reason to
worry.
WARNING: Couldn't compute a reliable estimate of monitor refresh interval! Trouble
with VBL syncing?!?
----- ! PTB - ERROR: SYNCHRONIZATION FAILURE ! ----
One or more internal checks (see Warnings above) indicate that synchronization
of Psychtoolbox to the vertical retrace (VBL) is not working on your setup.
This will seriously impair proper stimulus presentation and stimulus presentation
timing!
Please read 'help SyncTrouble' for information about how to solve or work-around the
problem.
You can force Psychtoolbox to continue, despite the severe problems, by adding the
command
Screen('Preference', 'SkipSyncTests', 1); at the top of your script, if you really
know what you are doing.
Error using Screen
See error message printed above.
Error in ReverseCorrelationFaces (line 81)
window=Screen('OpenWindow', windowNum);
What am I missing? A package? Is my hardware not okay? I can't figure this error out.
So.. buried deep inside the DownloadPsychtoolbox.m file found here (see installation instructions here), is the instruction that apparently Psychtoolbox requires a special SDK. Super annoying. I will never use this toolbox again because it's so much drama to use. But this is what was missing that was causing the Screen call to fail
Missing SDK download link:
http://docs.gstreamer.com/display/GstSDK/Installing+on+Windows