MATLAB Answers

error in my code

2 views (last 30 days)
thelong le
thelong le on 12 Jun 2021
Edited: Stephen Cobeldick on 12 Jun 2021
I can't use csview() command, when I run the program, my command shows an error (' Unrecognized function or variable 'csview'.' )
and my code
% generate two clusters of color points
rgb = min(abs(randn(2000,3).*[0.5 0.3 0.1] + [0 0 0]),1);
rgb = [rgb; 1-rgb];
xyz = rgb2xyz(rgb);
xlabel('X');
ylabel('Z');
zlabel('Y');
hold on;
% plot the points
scatter3(xyz(:,1),xyz(:,3),xyz(:,2),10,rgb,'.');
view(3); grid on;
axis equal
axis([0 1 0 1.1 0 1]);
set(gca,'color','k','gridcolor','k','gridalpha',0.3)
set(gca,'projection','perspective');
view('xyz','alpha'0.2,'invert',1); hold on; % do this before scatter3()
how to fix this
many thanks ^^

Answers (1)

Stephen Cobeldick
Stephen Cobeldick on 12 Jun 2021
Edited: Stephen Cobeldick on 12 Jun 2021
You need to download this FEX submission (by clicking on the big blue "Download button"):
and unzip it onto your MATLAB Search Path or into the current folder.
Have you done that?
  2 Comments
Stephen Cobeldick
Stephen Cobeldick on 12 Jun 2021
Do NOT add, remove, alter, edit, or change in any way the files in the MATLAB installation directories!
This is a very odd path, it looks like an installation or temporary installation path:
C:\Users\DELL\Downloads\_temp_matlab_R2021a_win64\bin\win64
A BIN directory is a big red flag, telling you "no, do not work in this directory". As a beginner you should put all of your own files (and any files you download, etc) into the default MATLAB startup directory, which on Windows is:
C:\Users\<user>\Documents\MATLAB
You can also save MATLAB files in other locations and change the Search Path to suit:
but NEVER in any installation directories of ANY application installed on your computer.

Sign in to comment.

Tags

Community Treasure Hunt

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

Start Hunting!