Filter löschen
Filter löschen

Matlab importdata() function fails over remote session

24 Ansichten (letzte 30 Tage)
J G
J G am 26 Mai 2020
Kommentiert: Wayne am 6 Jun. 2022
Hi,
I am attempting to use the Matlab importdata() function in a script which I run over a remote session on a VM. My script imports data (a list of numbers) from an excel spreadsheet into a variable. The script works perfectly when I am logged into the VM via Windows 10 RDC, but fails when I am logged in via Powershell (PS-Session) or Windows 10 SSH.
Other Matlab scripts that I have run remotely in this manner have executed fine. I have only noticed this behavior with the importdata() function.
Here are the contents of my test script (testImportData.m):
disp('Lets try importing the data!');
myData = importdata('test.xlsx');
disp('The data is: ');
disp(myData)
This is the command I used to execute the script in my remote Powershell session:
matlab -r testImportData -logfile myLog.txt
This is the output of the log file containing the returned error message:
---------------------------------------------------
Lets try importing the data!
[Warning: File contains uninterpretable data.]
[> In <a href="matlab:matlab.internal.language.introspective.errorDocCallback('importdata', 'C:\Program Files\MATLAB\R2019a\toolbox\matlab\iofun\importdata.p', 146)" style="font-weight:bold">importdata</a> (<a href="matlab: opentoline('C:\Program Files\MATLAB\R2019a\toolbox\matlab\iofun\importdata.p',146,0)">line 146</a>)
In <a href="matlab:matlab.internal.language.introspective.errorDocCallback('testImportData', 'C:\Users\myUserName\Documents\testImportData.m', 2)" style="font-weight:bold">testImportData</a> (<a href="matlab: opentoline('C:\Users\myUserName\Documents\testImportData.m',2,0)">line 2</a>)]
The data is:
data: []
textdata: {}
--------------------------------------------------
I have attached the relevant files.
Thanks!
  1 Kommentar
Wayne
Wayne am 6 Jun. 2022
Hello, I have a question, how did you set up your powershell to where you can run Matlab commands from the command line, everytime I just try to call Matlab it does not recognize.

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

J G
J G am 15 Jun. 2020
So for those who are interested, based on info I recieved from Mathworks tech support, it seems that this is a known behavior. Importdata cannot access the excel program in a remote session via SSH, or PS-Remote. I think the following posts may be related:
I did try the solutions suggested and adjusted the Excel com settings, but this did not work for me.
My workaround was to use the readcell function instead of importdata, which does work.

Weitere Antworten (0)

Kategorien

Mehr zu Standard File Formats finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by