Extract Excel files to Matlab skript

조회 수: 1 (최근 30일)
Abdelmajid Mettari
Abdelmajid Mettari 2017년 9월 5일
편집: Abdelmajid Mettari 2017년 9월 18일
I would like to import some commands from Excel into for loop and then execute these commands. These commands have different lengths that is why I need several loops for those lengths.
Can anybody help me please??
  댓글 수: 1
José-Luis
José-Luis 2017년 9월 5일
Have you read the documentation?
You could start with xlsread() or readtable().

댓글을 달려면 로그인하십시오.

답변 (1개)

Image Analyst
Image Analyst 2017년 9월 5일
We probably can help you. So read this link and then get back to us with a file attached, and what commands you'd like to execute on the imported data. But does your Excel file have numerical data in it, or the actual commands themselves?
If the commands you want to execute are actually text in the Excel cells, for example cell A1 has msgbox('Hello from Excel') in it and you want to execute
msgbox('Hello from Excel')
then you'll have to use eval().
[numbers, commands, raw] = xlsread(filename);
% Execute command in cell A1
eval(commands(1,1));
  댓글 수: 2
Abdelmajid Mettari
Abdelmajid Mettari 2017년 9월 5일
hi , thank you for you answer ,please find below a shortcut of my script
so this how it looks like,all these commands are in a columns in a excel sheet.
thank you again
Image Analyst
Image Analyst 2017년 9월 5일
It looks like you're building a cell array from a ton of variables. You didn't attach your workbook so I can't see what's in it. And you also didn't even show the code where you called xlsread() or readtable() to read in the workbook. I can't help, given what you've supplied (so far).

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Spreadsheets에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by