sir i have to generate the continuous 3d picture from the set of distance coordinates from centre,

1 view (last 30 days)
I want to input the values of coordinate from the usb. the questions you have provided they have used the load coord which shows error in my software.
load coord;
a=coord(:,1);
b=coord(:,2);
c=coord(:,3);
d=rand(1000,1)*2000;
dd = 0:2:1000;
[xq,yq,zq] = meshgrid(dd,dd,dd);
vq = griddata3(a,b,c,d,xq,yq,zq,'nearest');
h=figure;
plot3(a,b,c,'ro')
%=========================================%
fid=fopen('data.bin','w');
fwrite(fid,vq,'single');
fclose(fid);
  1 Comment
Geoff Hayes
Geoff Hayes on 12 Sep 2014
Shashi - please format the above code so that it is readable. Highlight the code portions of your question and press the {} Code button.
As well, you have stated that the load coord which shows error in my software. What is the error that you are observing?

Sign in to comment.

Answers (2)

Image Analyst
Image Analyst on 12 Sep 2014
Don't use the filename as the variable name also. Here is the fix:
storedStructure = load('coord.mat'); % File 'coord.mat' has variable coord inside it.
a=storedStructure.coord(:,1);
b=storedStructure.coord(:,2);
c=storedStructure.coord(:,3);

Star Strider
Star Strider on 12 Sep 2014
‘I want to input the values of coordinate from the usb.’
What does this mean? Are you: (1) loading files off of a USB drive, or (2) do you have an instrument with a virtual serial port and USB interface?
If (1), you have to use the function form of load, specifying the path to ‘coord’. It will likely not be in your MATLAB path, so you will have to find it with File Explorer (Windows).
If (2), you need to provide the details of what you are doing. You will probably have to look up the manufacturer’s documentation for the interface chip your device uses, and write the appropriate routines to write to it and read from it.

Tags

Community Treasure Hunt

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

Start Hunting!