Creating a midpoint map

1 view (last 30 days)
Norbert Smith
Norbert Smith on 27 Sep 2014
Commented: Image Analyst on 28 Sep 2014
Hi,
I'm very new to programming & MATLAB. Basically, I have to compare the raw data (19*19) to its corresponding row's & column's midpoint values (which I already have stored as variables). I'm struggling with MATLAB's syntax. Cheers
This is the pseudocode:'// Calculate and create our midpoint map array
FOR rowIndex TO MAX_ROWS
FOR columnIndex TO MAX_COLUMNS
value = rawData[rowIndex, columnIndex]
'// Compare the rawData value to its corresponding row's and column's midpoint, and store a character into the midpointMap array
IF value > rowMidpoints[rowIndex] && value > columnMidpoints[columnIndex] THEN
midpointMap[rowIndex, columnIndex] = GREATER_THAN_CHAR
ELSE
IF value < rowMidpoints[rowIndex] && value < columnMidpoints[columnIndex] THEN
midpointMap[rowIndex, columnIndex] = LESS_TAHN_CHAR
ELSE
midpointMap[rowIndex, columnIndex] = NEITHER_CHAR
END IF
END FOR
END FOR

Answers (1)

Image Analyst
Image Analyst on 27 Sep 2014
Replace FOR with for. Replace END FOR and END IF with end. Replace [ and ] with ( and ). Replace IF with if. Replace ELSE with else. Totally eliminate the THEN. Replace '// with %. I think it should work then.

Categories

Find more on Characters and Strings in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!