Creating a midpoint map
1 view (last 30 days)
Show older comments
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
0 Comments
Answers (1)
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.
2 Comments
Image Analyst
on 27 Sep 2014
Also check this out: http://www.mathworks.com/matlabcentral/answers/8026-best-way-s-to-master-matlab
See Also
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!