回答済み
How can I make an array using for loop?
TimeSeries = vertcat(Time{:,1}); https://www.mathworks.com/help/matlab/matlab_prog/comma-separated-lists.html https://www.math...

3年以上 前 | 1

回答済み
Retrieving numbers present within an array by knowing the coordinates
The simple and efficient MATLAB approach is to use SUB2IND: SI = load('image_DEF_numero_pixel.mat') im = SI.image_DEF_numero_p...

3年以上 前 | 0

| 採用済み

回答済み
readtable fail to import .22p file
One simple approach is to call DETECTIMPORTOPTIONS() on a known good file**, and use those options for all of the other files. T...

3年以上 前 | 0

| 採用済み

回答済み
Plotting a function with an array of x returns one y value
You won't get very far using MATLAB if you do not learn the difference between array and matrix operations: https://www.mathwor...

3年以上 前 | 0

回答済み
Files are not loading into my program
"i dont really know what am i doing wrong..>" You are using LS() instead of DIR(). LS() is intented for a pretty display, not ...

3年以上 前 | 0

回答済み
Creating file path names in a loop
lensFile = System.IO.Path.Combine(fileDir, [fname,'.zmx']); % ^ ^

3年以上 前 | 0

| 採用済み

回答済み
convert cell array of mixed strings to cell array of numbers
ca = {' [1000 X X X X]', ' X', ' X', ' 1.234' } out = regexp(ca,'[^\s\[\]]+','match'); out = cellfun(@str2double,out,'uni',0)

3年以上 前 | 1

回答済み
A compact way to horizontally concatenate rows of many cell arrays ?
a = {{[0,0,1,4,1];[9,9,0,0,0];[2,3,5,1,2]};{[1 0 7 4,0];[2,8,8,2,6];[1,9,8,1,1]};{[7,7,6,0,6];[9,0,9,1,2];[3,9,2,4,6]};{[3,3,3,2...

3年以上 前 | 1

| 採用済み

回答済み
generate out put names and output number dynamically
Because you did not upload any data I will use an inbuilt dataset: S = load('fisheriris.mat'); X = S.meas(:,3:4); Now lets gr...

3年以上 前 | 0

| 採用済み

回答済み
A compact way to sum the elements contained in two cell arrays (considering the case of empty cells as well)
a = {[0,0,0,0,0,0,0,36,43,48,42,49,51,64,55,57,86,69,53,37,35,37,31,0]; [21,0,0,0,0,0,0,31,64,53,50,81,55,72,76,93,108,81,8...

3年以上 前 | 1

| 採用済み

回答済み
How can I access a nested struct data by indexing of the fields?
url = 'https://lotus.naturalproducts.net/api/search/simple?query='; sfx = 'LTS0120864'; raw = webread(strcat(url,sfx)) "Howev...

3年以上 前 | 1

| 採用済み

回答済み
I just wrote a recursive function which create a structure nested by the fieldnames given by an array but it doesn't work
The simple MATLAB approach is to use SETFIELD() with a comma-separated list: C = {'f1','f2','f3'}; V = pi; S = struct(); S =...

3年以上 前 | 0

回答済み
Error using vertcat and how to solve it?
f = @(t,x) [-x(4)-(0.424)+(1.6977)*exp(-1.35*10^20*(x(1)^2)); x(4)-(0.663)+(2.6540)*exp(-1.35*10^20*(x(2)^2)); -(2.994...

3年以上 前 | 0

| 採用済み

回答済み
How to load multiple .mat files which are having subfile in .mat format using the loop?
Unfortunately the data in those MAT files is very badly designed, because each MAT file uses a changing prefix on the variable n...

3年以上 前 | 0

| 採用済み

回答済み
Accessing and synchronizing timetables in cell array?
Do not use a loop for this! The simple MATLAB approach is to use a comma-separated list: https://www.mathworks.com/help/matlab/...

3年以上 前 | 1

| 採用済み

回答済み
How to create separate matrix in workspace for each iteration
"I want to save loop data after each itteration in new workspace with new variable name.Like in first loop i want to save data i...

3年以上 前 | 1

| 採用済み

回答済み
Select sequence of numbers from Array
V = [1 1 1 2 2 2 3 3 3 4 4 4 1 1 1 2 2 2 3 3 3 4 4 4 1 1 1 2 2 2 3 3 3 4 4 4 1 1 1 2 2 2 3 3 3 4 4 4]; X = V(:)==1; Y = cumsum...

3年以上 前 | 0

回答済み
Save table with cell arrays in csv
T = load('table.mat').table % !!! do NOT use "table" as a variable name !!! F = @(v)strjoin(string(v),','); T = convertvars(T,...

3年以上 前 | 0

| 採用済み

回答済み
Save each iteration of a for loop to table
With MATLAB it is invariably easier to loop over indices, rather than looping over data values directly. V = [-1,-0.5,-0.1,0,0...

3年以上 前 | 0

| 採用済み

回答済み
How I can return output from function 'A' for using them as input for another function 'B'?
How to call function with output arguments is explained in the introductory tutorials: https://www.mathworks.com/help/matlab/ge...

3年以上 前 | 0

| 採用済み

回答済み
I want to export data to txt file in Loop
P = 'absolute or relative path to where the files are saved'; S = dir(fullfile(P,'*.txt')); for k = 1:numel(S) F = fullfi...

3年以上 前 | 0

| 採用済み

回答済み
i am tring to input different z values to get different B using matrix manipulation. just having trouble using for loop
Note that I replaced the INV()* with the recommended MLDIVIDE: https://www.mathworks.com/help/matlab/ref/inv.html#bu8tv8c-6 An...

3年以上 前 | 0

| 採用済み

回答済み
How can i calculate the length of curve?
A very simple approach is to download John D'Errico's excellent ARCLENGTH function: https://www.mathworks.com/matlabcentral/fil...

3年以上 前 | 2

回答済み
How to measure elapsed time in hh:mm:ss?
You can do this with SECONDS(), but then it requires two lines. Here is a simple solution on one line: tic .. dur = duration(...

3年以上 前 | 0

回答済み
Str2double gives NaN
https://www.mathworks.com/matlabcentral/answers/437449-matlab-coder-giving-issue-with-textscan#answer_354189 X = "3.716,3.711,3...

3年以上 前 | 1

| 採用済み

回答済み
Why do I receive the error "Undefined function 'times' for input arguments of type 'matlab.graphics.chart.primitive.Line'"?
The basic problem is that you have re-used the variable name p. You think that p is some value from the start of your code, but ...

3年以上 前 | 0

| 採用済み

回答済み
How to find number of bit change between binary numbers?
A = ['110'; '101'; '011'; '111'; '100'; '001'; '010'] B = sum(diff(A,1,1)~=0,2)

3年以上 前 | 1

| 採用済み

回答済み
How to loop function for all timesteps in one text file
T = fileread('atomlocation.txt'); C = regexp(T,'(^\S+\s+\S+\s+\S+\s*\n)+','lineanchors','match') N = numel(C); fprintf('%d bl...

3年以上 前 | 0

| 採用済み

回答済み
How to create a 3D Matrix?
"While in python this matrix is of 3*2*5," Not really, it is actually just a whole lot of nested 1D lists. In some languages th...

3年以上 前 | 0

回答済み
This statement is not inside any function. (It follows the END that terminates the definition of the function "mixing_tank".)
The function definition needs to come after all of the other code. See: https://www.mathworks.com/help/matlab/matlab_prog/local...

3年以上 前 | 0

さらに読み込む