How to input a data variable with 2 different values?
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
I'm trying to make my variable S (section area of a member of a structure) to take on different values as I change the member of a structure. The program consists of determining and characterizing an engineering structure and to complete my project I used the "questdlg" in the data program to ask if all the bars had the same "S". When I answer yes I just input my single value and everything works fine but when I answer no and input the areas in each bar manually the program only assumes one value.
message = sprintf('As barras têm todas a mesma área de secção trasnversal?');
button = questdlg(message, 'Dados', 'Sim', 'Não', 'Sim');
drawnow;
if strcmpi(button, 'Sim')
fprintf('\n');
disp('As barras têm todas a mesma área da secção');
fprintf('\n');
S=input ('Área da secção transversal das barras = ');
elseif strcmpi(button, 'Não')
for j=1:NB
disp('Barra nº:')
fprintf('\n');
disp(j);
fprintf('\n');
S=input ('Área da secção transversal das barras = ');
end
end
On the "run" program I use:
S=fread(fid,1,'float32');
This means it is only reading one value but I wanted it to read at least two values. For example, one structure with 4 bars and 2 of those have S=10cm^2 and the other two have S=5cm^2. Can you help?
2 Kommentare
Image Analyst
am 16 Aug. 2022
What is the name of the structure variable? What are the fieldnames of the structure?
What is fid? Are you opening a file on disk for reading from?
Antworten (1)
Siehe auch
Kategorien
Mehr zu Functions 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!