storing value from a cell in an excel sheet

R1=xlsread('Geometric constants.xlsx','CRB','B2');
S1=xlsread('Geometric constants.xlsx','CRB','C2');
% this give me error
%so here geometric constants is the name of my sheet
%CRB the name of my sheet
%B2 the cell value
%is there an alternate way to read and store a cell value in my variable

Antworten (2)

Dyuman Joshi
Dyuman Joshi am 15 Jan. 2023
Verschoben: Image Analyst am 15 Jan. 2023

0 Stimmen

Try this
R1=readmatrix('Geometric constants.xlsx','Sheet','CRB','Range','B2')
S1=readmatrix('Geometric constants.xlsx','Sheet','CRB','Range','C2')
Image Analyst
Image Analyst am 15 Jan. 2023

0 Stimmen

You forgot to attach the workbooks. Make it easy for us to help you, not hard.
You can use readmatrix if the values are numbers. If the values are strings, then you should use readcell instead.
You said "geometric constants is the name of my sheet" but did you really mean "geometric constants is the name of my workbook file"? Because you're telling xlsread that CRB is the name of the sheet, not "geometric constants"
Finally, you also forgot to tell us what the error actually was. The code looks correct so I don't know what the error message is since my Crystal Ball Toolbox is still on back order.
If you have any more questions, then attach your workbook file with the paperclip icon after you read this:

1 Kommentar

Arkadip Khan
Arkadip Khan am 16 Jan. 2023
Hey, yeah I'm so sorry my question was so patchy and with any info at all, yes you are right geometric constants is the name of my workbook file and crb is the sheet name, i definetly do need a tutorial to learn how to ask a question so sorry for my incompetence.
coming to the question yes the value i want to store in my variable is no., will give it a shot with readmatrix and update you, thankyou so much for replying to such an awfully put question.

Melden Sie sich an, um zu kommentieren.

Produkte

Version

R2022b

Tags

Gefragt:

am 15 Jan. 2023

Kommentiert:

am 16 Jan. 2023

Community Treasure Hunt

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

Start Hunting!

Translated by