How to implement separation requirements

Hi all,
i'm having trouble on where/how to begin this task. essentially i have an excel spreadsheet (For sake of ease) that contain separation requirements (mm) of various objects if theyre selected with each other. I'd like to implement these separation requirements into matlab which can allow a user to select -initially- a few of the objects and be able to output the relative distances between each entity. how can i go sbout doing this? ideally id like to just import the selected tables into matlab, since there are many objects and thus a lot of separation requirements but its how to code in these rules thats throwing me off. any help will be greatly appreciated. any questions, ask away!

 채택된 답변

Pranjal Kaura
Pranjal Kaura 2021년 12월 29일

0 개 추천

Hey Zain,
Could you please share a snippet of the data file? Further providing an example which explains what functionality you want from that data would also be helpful.
This link can be used to draft questions effectively. It will provide clarity to further help you.

댓글 수: 3

Zain Zia
Zain Zia 2022년 1월 5일
Hi Pranjal,
I've re-uploaded the question with an example of the excel file and code here:
Any help will be greatly appreciated.
Thanks
Hey Zain,
You can refer the following code snippet
data = readtable('Example.xlsx', 'VariableNamingRule', 'preserve');
pipe1Data = data.('Pipe 1');
pipe2Data = data.('Pipe 2');
seperationData = data.('Separation');
pipe1prompt = 'Select the first pipe type ';
pipe1_Input = input(pipe1prompt, 's');
pipe2prompt = 'select the second pipe type ';
pipe2_Input = input(pipe2prompt, 's');
[row,col] = find(cellfun(@(x)isequal(x,pipe1_Input), pipe1Data) & cellfun(@(x)isequal(x,pipe2_Input), pipe2Data));
for i = 1:length(row)
disp(seperationData(row(i), col(i)));
end
Hope this helps!
Zain Zia
Zain Zia 2022년 1월 6일
thank you, that's worked perfectly!

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

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Data Import from MATLAB에 대해 자세히 알아보기

제품

릴리스

R2021a

질문:

2021년 11월 15일

댓글:

2022년 1월 6일

Community Treasure Hunt

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

Start Hunting!

Translated by