storing value from a cell in an excel sheet
Afficher commentaires plus anciens
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
Réponses (2)
Dyuman Joshi
le 15 Jan 2023
Déplacé(e) : Image Analyst
le 15 Jan 2023
Try this
R1=readmatrix('Geometric constants.xlsx','Sheet','CRB','Range','B2')
S1=readmatrix('Geometric constants.xlsx','Sheet','CRB','Range','C2')
Image Analyst
le 15 Jan 2023
0 votes
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 commentaire
Arkadip Khan
le 16 Jan 2023
Catégories
En savoir plus sur Spreadsheets dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!