Answered
How to use 1 column and all rows from a matrix in each iteration?
for k = 1:size(M,2) M(:,k) end

4 years ago | 1

| accepted

Answered
Stacking diagonal matrices generated from rows of other matrix
The simplest approach is probably just to use an intermediate cell array: N = 4; M = magic(N); C = cell(1,N); for k = 1:N ...

4 years ago | 0

| accepted

Answered
Obtain multiple function handles as outputs from one single function for optimisation.
Get rid of FIRST_FUNC. Move all of the code that depends on x to SECOND_FUNC. Something like (untested, but should get you sta...

4 years ago | 0

| accepted

Answered
Can I import multiple sheets from one excel file using for loop?
"Is it possible to get different individual output tables equal to the number of sheets within the original excel file for furth...

4 years ago | 1

| accepted

Answered
How to add the same headers to all matrices in a loop
If you really want to use MATLAB efficiently and make processing your data easier then: use indexing rather than dynamically na...

4 years ago | 0

| accepted

Answered
How to split a column with numerical values?
Here are two robust MATLAB approaches (both much more robust than blindly using STRUCT2ARRAY): S = load('data.mat'); ICCs = S....

4 years ago | 1

| accepted

Answered
I want to put numbers from 1 to 8 after the file name using 'for loop' and save this file name as a variable.
"In this way, I want to store each of them in a variable." That would be a very inefficient use of MATLAB. MATLAB is designed t...

4 years ago | 0

| accepted

Answered
Split an array using specific points
Simpler and more efficient than what you are attempting (although most likely you don't realise that yet): Y = [5;2;3;6;7;9;5;5...

4 years ago | 2

| accepted

Answered
How can i divide the data in rows in MATLAB
The solution is very simple: use TRANSPOSE, RESHAPE, TRANSPOSE. Why is TRANSPOSE required? Because of the order that arrays are...

4 years ago | 0

| accepted

Answered
How use Vlookup in matlab?
"How use Vlookup in matlab?" MATLAB uses a simpler yet more powerful and more versatile concept called indexing: https://www.m...

4 years ago | 0

| accepted

Answered
My Matlab code no longer works on my Apple M1 Mac
Cause: there is a DIR somewhere before the code you show: DIR finds no files matching the given filename pattern, so FILENAMES i...

4 years ago | 0

Answered
Assigned small array values into Big array using for loops
per = repelem(temp,4) Or if it is required to use some indexing: per(:) = repelem(temp,4)

4 years ago | 0

| accepted

Answered
How to index a cell array in a for loop
P = 'data_base'; V = [2,4,5,9,10,12,17,23,25]; N = numel(V); C = cell(1,N); for k = 1:N F = sprintf('icp_sat%d.txt'V(k)...

4 years ago | 0

Answered
My matlab script is throwing an error for array dimensionality. "Arrays have incompatible sizes for this operation."
In lieu of actual information, assuming that all input arguments are scalar: Shaft_deflection_calculation(1,2,3,4,5,6) The cau...

4 years ago | 0

| accepted

Answered
Unable to load multiple mat files
theFiles is already a structure, there is no point in creating another one when you can use theFiles already: myFolder = 'C:\Us...

4 years ago | 0

Answered
Error using second . Invalid date/time class. (I am working on guide)
Subtracting a DATETIME object from a DATETIME object, as you do on that line, returns a DURATION object. However the function S...

4 years ago | 1

Answered
Subscripted assignment between dissimilar structures within a table
A 1x1 structure is not empty, it is scalar: its size is independent of how many fields it has. You are trying to assign a struc...

4 years ago | 0

| accepted

Answered
What is the way to get only the desired part of the text?
txt = fileread('test.txt'); tkn = regexp(txt,'^(\w+):\s+(\d*\.?\d*)(\S*)','tokens','lineanchors'); tkn = vertcat(tkn{:}) vec ...

4 years ago | 0

Discussion


TUTORIAL: Comma-Separated Lists and How to Use Them
Introduction Comma-separated lists are really very simple. You use them all the time. Here is one: a,b,c,d That is a comma-se...

4 years ago | 11

Question


TUTORIAL: Comma-Separated Lists and How to Use Them
Introduction Comma-separated lists are really very simple. You use them all the time. Here is one: a,b,c,d That is a comma-se...

4 years ago | 2 answers | 7

2

answers

Answered
How do I use fprintf and looping to create a table from a single randomized variable?
Well, you made a reasonable start with this homework. I left small part for you to do: x = [-1.4074954934790074e+02,+1.15596735...

4 years ago | 0

| accepted

Answered
function is not working
old_num = '17'; old_base = 8; new_base = 7; result = base2base(old_num, old_base, new_base); fprintf('%i\n', result) %% !!!...

4 years ago | 0

Answered
When plotting datetime seconds are displayed as miliseconds
"How can this be corrected." Use the correct format (possibly when importing the data, we do not know how you defined those dat...

4 years ago | 0

| accepted

Answered
Graph Not Plotting for the For Loop Code
"What am I missing? " Assigning the values to an output array via indexing. Because you did not use indexing to assign the val...

4 years ago | 0

| accepted

Answered
Look up a value in an incomplete list
Simpler and more efficient: keys = ["a","b","c","d"]; vals = [3,4,2,1]; x = ["c","d","e"]; [idx,idy] = ismember(x,keys); ou...

4 years ago | 0

| accepted

Answered
How to generate Data using for loop
The simple and efficient MATLAB approach would be to use REPELEM, for example: val = [200,500,800,1000,800,900]; num = [120,40...

4 years ago | 0

| accepted

Answered
What are some good examples of non-continuous colormap applications?
"Are they particularly well suited to coloring 3D shapes/contours (as the name "colorcube" seems to imply)?" No, not particular...

4 years ago | 2

Answered
How to assign specific values to pixels?
m = [1,22,33;44,55,66;77,188,255] % pixel default value v = [1,1;22,4;33,9;44,35;55,48;66,90;77,99;188,200;255,300] % txt file ...

4 years ago | 0

| accepted

Answered
Finding the start of a number in one array based on the values of another.
x = [0,0,0,0,0,0,0,1,1,1,1,1,0,0,0,0,0,0,0,0,1,1,1,1,0,0,0,0]; y = [1,1,0,0,0,1,1,1,1,1,1,1,1,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1]; ...

4 years ago | 0

| accepted

Load more