This is my code:
it calculate y when the user give the input value.
clear
clc
prompt = 'What is the temperature value (in C)? \n.\n.\n ';
temperature = input(prompt)
y = abs(0.5*(temperature /15)*1.225*0.8*3.14*5^2*((2*9.8*200*((abs(15-temperature))/temperature))^0.5)^3)
how can I make matlab code real excel file and the excel file has a values and I want to make each one of these values is the tempreture, and then export new file with given new values.

 채택된 답변

Star Strider
Star Strider 2020년 5월 16일

0 개 추천

Use the readmatrix function (or xlsread if you do not have readmatrix). There are also others, such as readtable, depending on what you want to do.
Do the calculations, then use the corresponding write functions (linked to in the pages I linked to here) to write the results.

댓글 수: 7

I'm not familiar with xlsread ... how can i make matlab apply calculations on excel cells and then the result save it as new xlsx file?
I think these two lines will help
filename ='myExample.xlsx'; %creat a new file
xlswrite (myExample,mydata); % Save data to new file.
Star Strider
Star Strider 2020년 5월 16일
You cannot do it in Excel with MATLAB. You need to read the Excel file into your MATLAB workspace, do the calculations, then write what you want to a new Excel file. The xlswrite function is appropriate for that.
Ibrahim AlZoubi
Ibrahim AlZoubi 2020년 5월 16일
I see... but the thing that I can't do is the calculations part how to to the calculations for all cells?
in other words lets assume table name is t:
when I multiply:
t*2
result:
Undefined operator '*' for input arguments of type 'table'
If you read your data in as a table, in order to multiply all the elements in the table, you would need to do something like this:
t2a = table2array(t);
ax2 = t2a*2;
a2t - array2table(ax2);
then use the writetable function to write it to a file.
Ibrahim AlZoubi
Ibrahim AlZoubi 2020년 5월 16일
great now how to write a code converts from a2t to excel file?
Star Strider
Star Strider 2020년 5월 16일
Use the writetable function.

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

추가 답변 (0개)

카테고리

제품

질문:

2020년 5월 16일

댓글:

2020년 5월 16일

Community Treasure Hunt

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

Start Hunting!

Translated by